Absulit / Absulit/sinpefacil

Custom links to open directly on the app

Đang mở
#8 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
0
Fork
0
Merge trung bình
3 phút
Pull request đã merge (30 ngày)
99

Mô tả

Web App Launch Handlers (specifically using the launch_handler and scope_extensions manifest properties).

Step 1: Add launch_handler to your manifest.json
Add the launch_handler key to control how the OS directs web link navigations to an existing or new instance of your PWA:

```json
{
"name": "My Framework7 App",
"start_url": "/",
"scope": "/",
"display": "standalone",
"launch_handler": {
"client_mode": "focus-existing"
}
}
```

Client Modes:

"focus-existing" (Recommended): If the PWA is already open, tapping the web link brings the existing app window to the focus and passes the URL navigation to it.

"navigate-new": Opens a brand new window of your PWA for that specific link.

Step 2: Handle Incoming Links in JavaScript (Optional)
If your app is already open and configured with focus-existing, capture the deep link target inside your Service Worker or main script using the launchQueue API:

```js
if ('launchQueue' in window) {
window.launchQueue.setConsumer((launchParams) => {
if (launchParams.targetURL) {
const url = new URL(launchParams.targetURL);
console.log('Deep-linked URL path:', url.pathname);

// Use Framework7 router to navigate directly to the requested screen
if (window.app && window.app.views.main) {
window.app.views.main.router.navigate(url.pathname);
}
}
});
}
```

OS Platform Support Matrix

OS / Browser | Auto-Open Behavior | Notes
-- | -- | --
Android (Chrome/Edge) | ✅ Supported | Requires PWA to be installed via "Add to Home Screen" or WebAPK.
Windows / macOS (Chrome/Edge) | ✅ Supported | Chrome prompts the user once to "Open link in app?" and remembers choice.
iOS / iPadOS (Safari) | ⚠️ Limited | iOS Safari does not natively support deep link interception for PWAs added to the Home Screen. iOS users opening web links will hit Safari unless you use a native wrapper (like Capacitor) with Universal Links / Digital Asset Links.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.