TrustedScriptURL: toString()-Methode
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Hinweis: Diese Funktion ist in Web Workers verfügbar.
Die toString()
-Methode der TrustedScriptURL
-Schnittstelle gibt einen String zurück, der sicher in eine Injection-Senke eingefügt werden kann.
Syntax
toString()
Parameter
Keine.
Rückgabewert
Ein String, der die bereinigte URL enthält.
Beispiele
Die Konstante sanitized
ist ein Objekt, das über eine Trusted Types-Richtlinie erstellt wurde. Die toString()
-Methode gibt einen String zurück, der sicher verwendet werden kann, um ein Skript eines Drittanbieters zu laden.
const sanitized = scriptPolicy.createScriptURL(
"https://example.com/my-script.js",
);
console.log(sanitized.toString());
Spezifikationen
Specification |
---|
Trusted Types # trustedscripturl-stringification-behavior |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
toString |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support