URL.toString()

La méthode URL.toString() retourne un USVString contenant tout l'URL. C'est en effet, une version de URL.href (en-US) en lecture seule.

Note: Cette fonctionnalité est disponible via les Web Workers.

Syntaxe

js
string = url.toString();

Paramètres

Aucun.

Valeur de retour

Examples

js
const url = new URL(
  "https://developer.mozilla.org/fr/docs/Web/API/URL/toString",
);
url.toString(); // doit retourner l'URL en tant que chaîne

Spécifications

Specification
URL Standard
# URL-stringification-behavior

Compatibilité des navigateurs

BCD tables only load in the browser

Voir aussi

  • L'interface URL à laquelle elle appartient.