Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.

Re: Set/Navigate to a Location (what is the correct way?)

Skip to first unread message

Dr J R Stockton

Apr 15, 2007, 12:23:03 PM4/15/07
In comp.lang.javascript message <461ffd69$0$24719$
m>, Fri, 13 Apr 2007 18:00:09, Michael White <> posted:

>"document.location" is deprecated, use "document.URL" or
>"location.href" or "window.location.href"

A <FAQENTRY> on "Deprecated" might well be useful, though it would need
to be backed up by a Web page.

(c) John Stockton, Surrey, UK. ? Turnpike v6.05 MIME.
Web <URL:> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)

Apr 15, 2007, 3:30:09 PM4/15/07
I'm not sure what happened to the begining of this thread, but I
figured out what was happening.

In IE6 only, if you have a link (change square brackets for angled)

[a href="javascript:;" onclick="doSomething"]Click Me[/a]


function doSomething(){
document.location.href = '';

It won't work.. well, kind of. It actually does the HTTP GET request,
on "", but the original page never leaves the screen, the
"flag" in the corner doesn't wave, and the progress bar only flashes
for a few milliseconds. As far as the user sees it, nothing happened.
(even the history of visiting this link is not stored)

Its like 1/2 AJAX in IE6, without the ActiveX, and without the

Apr 13, 2007, 4:21:04 PM4/13/07
Hi all,

This may sound real strange, but I'm curious what the "official"
answer is.

In my JS, I want to redirect/navigate to a url...

In Mozilla,

document.location.href = '{my_url}'; //works in Moz, IE6, IE7, Opera,

window.location.href = '{my_url}'; //works in Moz, IE6, IE7, Opera,

But.... there are times, in IE6, when...

document.location.href = '{my_url}';

does *NOT* work... and IE just ignores the request...

Now, from all the specs I read, it looks like location.href was only
ever intended to be read-only... but browsers seemed to make it
editable... and in IE6, document.location.href( '{my_url}' ); even
works (sometimes), because MS added this ability because so many were
trying it, finding it not to work, and submitting bugs...

So, 2 questions...

1.) What is the "official" way to set the page location (e.g. to some
other page)
2.) If document.location.href is fine, anyone know why IE sometimes
ignores it, when it is set to a new value?

Michael White

Apr 13, 2007, 6:00:09 PM4/13/07
to wrote:

"document.location" is deprecated, use "document.URL" or "location.href"
or "window.location.href"


0 new messages