A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.cdn.mozilla.net/en-US/docs/Web/API/Location/toString below:

Location: toString() method - Web APIs

MDN Web Docs
  1. Web
  2. Web APIs
  3. Location
  4. toString()

Filter sidebar

In this article
  1. Location
  2. Instance properties
    1. ancestorOrigins
    2. hash
    3. host
    4. hostname
    5. href
    6. origin
    7. pathname
    8. port
    9. protocol
    10. search
  3. Instance methods
    1. assign()
    2. reload()
    3. replace()
    4. toString()
In this article Location: toString() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2016.

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

Syntax

js

toString()
Parameters

None.

Return value

A string representing the object's URL.

Examples

js

// Let's imagine this code is executed on https://example.com/path?search#hash
const result = window.location.toString(); // Returns: 'https://example.com/path?search#hash'
Specifications Specification HTML
# dom-location-href-dev
Browser compatibility Help improve MDN Was this page helpful to you? Learn how to contribute

.

This page was last modified on Nov 26, 2023 by MDN contributors.

View this page on GitHub

•

Report a problem with this content

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4