Nasi wolontariusze nie przetłumaczyli jeszcze tego artykułu na język Polski. Dołącz do nas i pomóż go przetłumaczyć!
Można także przeczytać artykuł w języku: English (US).

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The Document.documentURIObject read-only property returns an nsIURI object representing the URI of the document.

This only works for privileged (UniversalXPConnect) scripts, including extension code. For web content this property doesn't have any special meaning and can be used just like any other custom property.

Privileged code must be careful not to try getting or setting this property on a non-wrapped content object (e.g., on a wrappedJSObject of an XPCNativeWrapper). See bug 324464's comments for details.

Syntax

var uri = document.documentURIObject;

Example

// Check that the URI scheme of the current tab in Firefox is 'http',
// assuming this code runs in context of browser.xul
let uriObj = content.document.documentURIObject;
let uriPort = uriObj.port;

if (uriObj.schemeIs('http')) {
  ...
}

Specifications

Not part of any specification.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic support
Non-standard
Chrome No support NoEdge No support NoFirefox No support ? — 57
Notes
No support ? — 57
Notes
Notes Available only to legacy extensions.
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support ? — 57
Notes
No support ? — 57
Notes
Notes Available only to legacy extensions.
Opera Android No support NoSafari iOS No support NoSamsung Internet Android ?

Legend

No support  
No support
Compatibility unknown  
Compatibility unknown
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
See implementation notes.
See implementation notes.

Autorzy i etykiety dokumentu

Ostatnia aktualizacja: mfuji09,