LaunchParams: targetURL property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("Launch Handler API")}}{{SeeCompatTable}}
The **targetURL** read-only property of the {{domxref("LaunchParams")}} interface returns the target URL of the associated web app launch.
Value
A string.
Examples
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.slice(1);
audio.play();
}
}
});
}Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- Launch Handler API: Control how your app is launched
- {{domxref("Window.launchQueue")}}