zl程序教程

您现在的位置是:首页 >  其它

当前栏目

Window.location

window Location
2023-09-11 14:14:18 时间

Window.location

  1. Web technology for developers
  2. See Web APIs
  3. See Window
  4. Window.location

The Window.location read-only property returns a Location object with information about the current location of the document.

Though Window.location is a read-only Location object, you can also assign a DOMString to it. This means that you can work with location as if it were a string in most cases: location = 'http://www.example.com' is a synonym of location.href = 'http://www.example.com'.

See Location for all available properties.

 

Location: href

The href property of the Location interface is a stringifier that returns a USVString containing the whole URL, and allows the href to be updated.

Setting the value of href navigates to the provided URL. If you want rediredtion, use Location.replace().