开发者

Is javascript window.location crossbrowser?

Is javascript code window.location functional in all new and old STANDARD POP开发者_开发技巧ULAR browsers?


window.location, which shares the same structure as document.location should be identical between modern browsers for the following properties:

  • hash (except in FireFox ~< 16.0 where there was a bug with encoding)
  • hostname
  • href
  • pathname
  • port
  • protocol
  • search
  • reload()
  • replace()

Known Differences:

  • Only Webkit has location.origin at the time of writing.


I can't say 'all old browsers' since it may not work in Netscape Navigator 0.9 but yeah this is in the standard and is very widely supported.


window.location works in all major browsers

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜