Ticket #7858 (closed bug: invalid)
Access to attributes of location object
| Reported by: | daniel.degasperi@… | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.6 |
| Component: | unfiled | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
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
comment:1 follow-up: ↓ 2 Changed 2 years ago by dmethvin
- Status changed from new to closed
- Resolution set to invalid
comment:2 in reply to: ↑ 1 Changed 2 years ago by daniel.degasperi@…
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 21 months ago by peter.bremer@…
Here is a comment that mentions $(location): http://stackoverflow.com/questions/406192/how-to-get-the-current-url-in-jquery/2865546#2865546
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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?