Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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:
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 Changed 12 years ago by dmethvin

Resolution: invalid
Status: newclosed

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:2 in reply to:  1 Changed 12 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:4 Changed 12 years ago by anonymous

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 Timmy Willison

There aren't any in browsers we support. They are identical in IE6, FF 3.6, Safari, Chrome, Opera.

Note: See TracTickets for help on using tickets.