Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    39
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Firefox URL persists in popup despite "location=0"

    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?

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    not in firefox3, the window.open location option has been disabled as a security precaution.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    39
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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.

  • #4
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    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?
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

  • #5
    New Coder
    Join Date
    Jul 2008
    Posts
    39
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by ruffy View Post
    Can either, or both, be avoided?
    No. .
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

  • #7
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    when Firefox disabled it, they also forced it to display the parent page's url.

    again, there is nothing you can do about it.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #8
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    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.
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

  • #9
    New Coder
    Join Date
    Jul 2008
    Posts
    39
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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.

  • #10
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    ruffy,
    You cannot force someone to stay on a page, but you can ask if they want to leave.

    check out onbeforeunload.

    I have used it to check if a user really wants to leave a page but hasn't saved their work yet.
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

  • #11
    New Coder
    Join Date
    Jul 2008
    Posts
    39
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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.

  • #12
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    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:
    Code:
    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:
    Code:
    <form action="whatever.php" onsubmit="formSubmission = true;">

    I think that may help you get started with your own before unload prompt.
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

  • Users who have thanked eak for this post:

    ruffy (08-15-2008)

  • #13
    New Coder
    Join Date
    Jul 2008
    Posts
    39
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Thanks eak - I didn't dare ask that you bother, but
    since you offered, I thank you for the code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •