--- title: URL.toString() slug: Web/API/URL/toString tags: - API - Méthode - Reference - URL - toString() translation_of: Web/API/URL/toString ---
La méthode URL.toString() retourne un {{domxref("USVString")}} contenant tout l'URL. C'est en effet, une version de {{domxref("URL.href")}} en lecture seule.
{{AvailableInWorkers}}
string = url.toString();
Aucun.
Un {{domxref("USVString")}}.
const url = new URL("https://developer.mozilla.org/en-US/docs/Web/API/URL/toString");
url.toString() // doit retourner l'URL en tant que chaîne
| Spécification | Statut | Commentaire |
|---|---|---|
| {{SpecName('URL', '#URL-stringification-behavior', 'stringifier')}} | {{Spec2('URL')}} | Définition initiale. |
{{Compat("api.URL.toString")}}