Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect problem in two browsers but ok in one

Status
Not open for further replies.

abraxas

Programmer
Jan 15, 2001
75
AU
Hi there,
I checked this forum before I posted to see if there was something similar. There was one posting that mentioned submitting "_Blank" forms but I'm not submitting a form soooo....

I have this function in the <head> of an asp script.
function viewPrompt()
{
var getName;
getName = prompt("Enter something","");
if (getName != "")
{
alert(escape(getName) + " entered"); // just checking
// Redirect Time
document.location.href = " + escape(getName);
return true;
}
}
That's all
In action a user executes an onClick event (not a form) which calls viewPrompt(). A prompt box appears so user can type in anything. Hit enter alert box appears with string displayed but.... in Internet Explorer 6 and Opera 7.54 there is NO redirecting. In Mozilla Firefox 1.0.6 it does?!?!

At the moment the script calls itself where some asp picks up the get parm and displays it. Very pretty and only under mozilla.

I've tried redirecting to any other page which still works in firefox but not in opera and IE. Also I put a redirect OUTSIDE the function to see if there was a problem with browser privacy settings. Works in all browsers.

I've tried it without the alert box as well. Same result..
Mozilla Yep
Opera Nope
IE Nope

Does this look familiar to anyone? I have google toolbar installed on all browsers (unfortunately, I should read the install procedures a bit more) and have disabled pop-up blockers and the toolbars themselves. I've disable IE's pop up blocker too (restarted browser). Still no joy.

This is so annoyingly trivial and yet sort of worrying since I have several websites on this machine (locahost) all of which use location.href at some stage and they don't suffer any of this problem.

As Al Henderson (The Fly) would say
"help me..."

many thanks
abraxas
 
OOps.. forgot to mention
Using WnXP SPK2
abraxas
 
Hi cLFlaVA,
Thanks for responding.
As per request

<a href="javascript:void(0)" onClick="viewPrompt()">Click</a>
OR
<a href="#" onClick="viewPrompt()">

Do you think it might be the return value not being accounted for?

abraxas
 
Outstanding!
Thank you very much.
Is there an explanation behind this? Firefox seems to be able to gloss over whatever the reason is.
Many thanks
abraxas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top