Bug Tracker

Ticket #7858 (closed bug: invalid)

Opened 4 years ago

Last modified 3 years ago

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 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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 4 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 3 years ago by peter.bremer@…

comment:4 Changed 3 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 3 years ago by timmywil

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.