>"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. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - 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)
In IE6 only, if you have a link (change square brackets for angled)
[a href="javascript:;" onclick="doSomething"]Click Me[/a]
and...
[script]
function doSomething(){
document.location.href = 'http://www.example.com/';
}
[/script]
It won't work.. well, kind of. It actually does the HTTP GET request,
on "example.com", 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
postback.
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,
etc.
window.location.href = '{my_url}'; //works in Moz, IE6, IE7, Opera,
etc.
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?
"document.location" is deprecated, use "document.URL" or "location.href"
or "window.location.href"
Mick