mozilla
Your Search Results

    URLUtils.origin

    The URLUtils.origin read-only property is a DOMString containing the Unicode serialization of the origin of the represented URL, that is, for http and https, the scheme followed by '://', followed by the domain, followed by ':', followed by the port (the default port, 80 and 443 respectively, if explicitely specified). For URL using file: scheme, the value is browser dependant.

    Syntax

    string = object.origin;
    

    Examples

    // On this page, returns the origin
    var result = window.location.origin; // Returns:'https://developer.mozilla.org:443'
    

    Specifications

    Specification Status Comment
    URL
    The definition of 'URLUtils.origin' in that specification.
    Living Standard Initial definition.

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
    Basic support Not supported [1] Not supported Not supported [1] Not supported [1] Not supported [1]
    window.location.origin 32.0 21.0 (21.0) ? 19.0 ?
    Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
    Basic support Not supported [1] Not supported [1] Not supported Not supported [1] Not supported [1] Not supported [1]
    window.location.origin ? ? 21.0 (21.0) ? ? ?

    [1] Though not grouped in a single abstract interface, this method is directly available on the interfaces that implement it, if this interface is supported.

    See also

    Document Tags and Contributors

    Contributors to this page: ziyunfei, Korikulum, jonathanKingston, Kartik_Chadha, teoli
    Last updated by: jonathanKingston,