LaunchParams: targetURL 属性
值
一个字符串。
示例
js
if ("launchQueue" in window) {
window.launchQueue.setConsumer((launchParams) => {
if (launchParams.targetURL) {
const params = new URL(launchParams.targetURL).searchParams;
// Assuming a music player app that gets a track passed to it to be played
const track = params.get("track");
if (track) {
audio.src = track;
title.textContent = new URL(track).pathname.substr(1);
audio.play();
}
}
});
}
规范
规范 |
---|
Web 应用程序启动处理程序 API # ref-for-dom-launchparams-targeturl-7 |
浏览器兼容性
BCD 表格仅在浏览器中加载