#7858 closed bug (invalid)
Access to attributes of location object
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | 1.6 |
Component: | unfiled | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The following code worked with jQuery Versions <= 1.4.2:
$(location).attr('href', 'blank.php'); $(location).attr('href');
With Version 1.4.4 Firebug throws following exception:
a.setAttribute is not a function http://sandboxes.r3-gis/R3-Trees/sito/web/javascript/jquery/jquery.js Line 55
Change History (5)
comment:1 follow-up: 2 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 12 years ago by
Thanks for enlightening me.
I've got the code snippet from somewhere in the WEB, but I can't remember the URL. Meanwhile, much time has passed.
Replying to dmethvin:
It may have worked but it was never supported or documented. Simply use
document.location.href = "http ..."
which is faster, simpler, and easier to understand.This has come up a couple of times in the past, is this your own code or did you get it from somewhere? Can you provide a link?
comment:3 Changed 12 years ago by
Here is a comment that mentions $(location): http://stackoverflow.com/questions/406192/how-to-get-the-current-url-in-jquery/2865546#2865546
comment:4 Changed 12 years ago by
Wouldn't a jQuery object like this help to handle browser inconsistencies between document.location.href and window.location.href?
comment:5 Changed 12 years ago by
There aren't any in browsers we support. They are identical in IE6, FF 3.6, Safari, Chrome, Opera.
It may have worked but it was never supported or documented. Simply use
document.location.href = "http ..."
which is faster, simpler, and easier to understand.This has come up a couple of times in the past, is this your own code or did you get it from somewhere? Can you provide a link?