demo · v146
Target URL router
A PWA's manifest file_handlers array declares a target URL for each accept type. Pick a file from the OS shell; the router runs the same matching algorithm the browser uses, picks a handler, and shows which window opens and which URL lands in the address bar. Try drag-multiple to see the multi-client path.
Production behaviour: this is a simulator. To exercise the real path,
install a PWA with
file_handlers in its manifest, double-click a matching file in
the OS shell, and observe LaunchParams.targetURL in your launchQueue
consumer.
app manifest snippet
preset handlers
files in the shell
Pick a file to see what target URL the browser would launch.
no launch yet
// Consumer inside the launched window:
launchQueue.setConsumer((params) => {
console.log(params.targetURL);
// 146+: matches the file_handler.target_url for the type
for (const handle of params.files) {
// open handle …
}
});