Web/API/Location/toString

From Get docs

The toString() stringifier method of the Location interface returns a USVString containing the whole URL. It is a read-only version of Location.href.

Syntax

string = object.toString();

Examples

// Let's imagine an <a id="myAnchor" href="https://developer.mozilla.org/en-US/docs/Location/toString"> element is in the document
var anchor = document.getElementById("myAnchor");
var result = anchor.toString(); // Returns: 'https://developer.mozilla.org/en-US/docs/Location/toString'

Specifications

Specification Status Comment
HTML Living Standard Living Standard

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
toString Chrome

Full support 52

Edge

Full support 12

Firefox

Full support 22

IE Full support 11

Notes'

Full support 11

Notes'

Notes' Intranet sites are set to Compatibility View, which will emulate IE7 and omit window.location.toString.

Opera

?

Safari

?

WebView Android

Full support 52

Chrome Android

Full support 52

Firefox Android

Full support 22

Opera Android

?

Safari iOS

?

Samsung Internet Android

Full support 6.0

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
See implementation notes.'
See implementation notes.