Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the syntax of Location.assign ()

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how to use the grammar of Location.assign (). The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The Location.assign () method triggers the window to load and display the contents of the specified URL. If the jump cannot be performed for security reasons, a DOMException of type SECURITY_ERROR is thrown. The above error is thrown when the script source that calls this method and the source defined in the Location object of the page belong to different domains. If an invalid URL is passed in, a DOMException of type SYNTAX_ERROR is thrown.

Location.assign () syntax

Location.assign (url)

Parameters.

Url

A DOMString that contains the link to jump to.

Exampl

/ / Jump to Location.reload () this article

_ document.location.assign ('https://developer.mozilla.org/zh-CN/docs/Web/API/Location/reload');

Standardize

Specification status remarks

HTMLLivingStandard

Location.assign () LivingStandard is the same as HTML5.

HTML5

Location.assign () Recommendation is defined for the first time.

Browser compatibility

UpdatecompatibilitydataonGitHub

Desktop Mobile

Chrome Edge Firefox InternetExplorer Opera Safari Androidwebview ChromeforAndroid FirefoxforAndroid OperaforAndroid SafarioniOS SamsungInternet

Assign Fullsupport1 Fullsupport12 Fullsupport1 Fullsupport5.5 Fullsupport3 Fullsupport3 Fullsupport1 Fullsupport18 Fullsupport4 Fullsupport10.1 Fullsupport1 Fullsupport1.0

Location.assign () instance

Use assign () to load a new document:

Rookie course (runoob.com)

FunctionnewDoc () {

_ window.location.assign ")

}

Thank you for reading! This is the end of the article on "how to use Location.assign () Grammar". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report