This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The Range() constructor returns a newly created Range object whose start and end is the global Document object.


range = new Range()


range = new Range();
endNode = document.getElementsByTagName('p').item(3);
endOffset = document.getElementsByTagName('p').item(3).childNodes.length;
range.setEnd(endNode, endOffset);


Specification Status Comment
The definition of 'Range.Range()' in that specification.
Living Standard Initial definition.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic support
Chrome Full support YesEdge Full support YesFirefox Full support 24IE No support NoOpera Full support 15Safari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 24Opera Android Full support 15Safari iOS Full support YesSamsung Internet Android ?


Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

See also

Document Tags and Contributors

Contributors to this page: mfluehr, fscholz, bethge, teoli, jsx, kscarfone, Sheppy
Last updated by: mfluehr,