English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Location assign() Method

JavaScript Location  Object

assign()The method causes the window to load and display the file specified at the URL.

    If the assignment cannot be performed due to a security conflict, then a DOMException of type SECURITY_ERROR is thrown.

Syntax:

location.assign(URL)
location.assign("https://www.oldtoolbag.com");
Test See‹/›

Browser Compatibility

All browsers fully support the Assign() method:

Method
assign()IsIsIsIsIs

Parameter Value

ParameterDescription
URLA string containing the URL of the page to be viewed

Technical Details

Return Value:None

Related References

Location Reference:location.reload() method

Location Reference:location.replace() method

JavaScript Location  Object