Something went wrong. Try again.
Rewild Your Web
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273<!doctype html><!-- SPDX-License-Identifier: AGPL-3.0-or-later --><html> <head> <title>Web Tasks Test</title> <style> body { font-family: system-ui, sans-serif; max-width: 600px; margin: 2em auto; padding: 0 1em; } button { padding: 0.6em 1.2em; font-size: 1em; cursor: pointer; border-radius: 6px; border: 1px solid #ccc; background: #0066cc; color: #fff; } button:hover { background: #0055aa; } #result { margin-top: 1em; padding: 1em; background: #f5f5f5; border-radius: 6px; white-space: pre-wrap; font-family: monospace; min-height: 2em; } </style> </head> <body> <h1>Web Tasks Test</h1> <p> Click the button to request the <strong>share</strong> task with type <code>text/uri-list</code>. </p> <p> <em >The share provider is registered automatically via a <code><meta name="beaver-tasks"></code> tag in the system UI.</em > </p>
<button id="share-btn">Request "share" task</button> <div id="result">Ready.</div>
<script> const resultEl = document.getElementById("result");
document .getElementById("share-btn") .addEventListener("click", async () => { resultEl.textContent = "Requesting task..."; try { const result = await navigator.requestTask("share", { type: "url", url: location.href, text: "Check out this test page!", }); resultEl.textContent = "Result: " + JSON.stringify(result, null, 2); } catch (e) { resultEl.textContent = "Error: " + e.message; } }); </script> </body></html>