...

View Full Version : Firefox URL persists in popup despite "location=0"



ruffy
08-13-2008, 05:15 PM
I open a popup window using Firefox,
with a spec that reads "location=0", (which is the default anyway).

This spec in fact disables user modification of the displayed URL,
but, for one thing, the URL stays on display,
and, more importntly, there's the arrow next to the URL
the user can click to reach an error page.

Can either, or both, be avoided?

rnd me
08-13-2008, 06:42 PM
not in firefox3, the window.open location option has been disabled as a security precaution.

ruffy
08-13-2008, 06:53 PM
rnd me - you misunderstood me.
I am aware of the disabling.
I want to know if I can eliminate the URL altogether
or eliminate or disable the arrow to the right of the URL.

eak
08-13-2008, 07:18 PM
ruffy, the little arrow is a part of the location bar and cannot be disabled.
Just as rnd me said, the location bar cannot be hidden in popup windows due to improved security.

What exactly are you having problems with? What is the error page you referred to?

ruffy
08-14-2008, 04:09 AM
eak - The Firefox's URL has this arrow after the disabled URL.
Were the user to click that arrow for some reason,
he'd be taken to my main screen, which does not expect
such a move and therefore would throw up all sorts of errors.
My Submit button on that popup is the one that has to be clicked,
nothing else.

In Safari that entire URL field can be eliminated with location = 0.
But not in Firefox. That arrow may never get pressed by a user,
but as a coder I have to think of all "unlikelihoods" just to keep
things clean, always.

Thus my original question.

hemebond
08-14-2008, 10:49 AM
Can either, or both, be avoided?No. .

rnd me
08-14-2008, 02:18 PM
when Firefox disabled it, they also forced it to display the parent page's url.

again, there is nothing you can do about it.

eak
08-14-2008, 03:40 PM
Since you can't do anything about the location bar (in FF3), you may want to recode your "main screen" to remove the errors.

Is there a URL we can go to? Maybe we can help.

ruffy
08-14-2008, 05:16 PM
eak - How about if I code into the document
where an attempt to navigate out of it simply
brings the user right back,
thus forcing him to use the Submit to go anywhere.

eak
08-14-2008, 05:44 PM
ruffy,
You cannot force someone to stay on a page, but you can ask if they want to leave.

check out onbeforeunload (http://www.google.com/search?q=onbeforeunload).

I have used it to check if a user really wants to leave a page but hasn't saved their work yet.

ruffy
08-14-2008, 07:50 PM
eak - Using onbeforeunload will be tricky and will need plenty of code
because it executes also when the user exits using the
upper corner X icon,
and even when the user properly hits the Submit button.

eak
08-14-2008, 09:54 PM
This is the JS I used on one of my projects.
It only prompts the user if a form was modified or if they didn't click the submit button.

Javascript:


var formSubmission = false;
window.onbeforeunload = function(){
if( !formSubmission && formValueHasChanged() )
return 'You have not saved yet.';
}

function formValueHasChanged(){
var f = document.forms, i = 0, l = f.length;
for( ; i < l ; ++i ){
var elms = f[i].elements, j = 0, el = elms.length;
for( ; j < el ; ++j ){
if( !isset(elms[j].defaultValue) )continue;
if(elms[j].value!=elms[j].defaultValue)return true;
}
}
return false;
}


HTML:

<form action="whatever.php" onsubmit="formSubmission = true;">


I think that may help you get started with your own before unload prompt.

ruffy
08-15-2008, 02:08 AM
Thanks eak - I didn't dare ask that you bother, but
since you offered, I thank you for the code.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum