SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast Aquis's Avatar
    Join Date
    Jun 2006
    Location
    Uttoxeter, Staffordshire, UK
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    window.open in IE7

    Hi,

    I have a generic function for creating pop ups used throughout the site:

    Code:
    function popUp(location,width,height) {
    	if (width == null || width == 0) {
    		width = screen.width / 2;
    	}
    	if (height == null || height == 0) {
    		height = screen.height / 2;
    	}
    	var left = (screen.width / 2) - (width / 2);
    	var top = (screen.height / 2) - (height / 2);
    	wins += 1;
    	var theWin = window.open(location,"window_" + (wins - 1),"directories=no,height=" + height + ",left=" + left + ",location=no,menubar=no,resizable=yes,status=no,scrollbars=yes,toolbar=no,top=" + top + ",width=" + width + ",z-lock=no");
    	theWin.is_popUp = true;
    }
    Now, as usual, in Safari, FireFox, Opera and even IE:mac and IE <= 6; this works! But - in IE7, I get a window with an address bar still in it! I've tried changing the configuration of the options in the window.open method to every possible combination, but, try as I might, the address bar / navigation bar always remain. At first, I thought it could be the document type, which, was set to strict XHTML, but changing it to transitional didn't do anything different. I even tried mimicking the code of pages that it does work on, but still nothing happens! The code which executes the function looks like this:

    HTML Code:
    <script type="text/javascript">
    	<!--
    		document.write("<a href=\"javascript:popUp('/popup_review.php?id=0',300,400);\">Add Review</a>");
    	//-->
    </script>
    It is written using document.write as to provide a <noscript> version, but on its own it doesn't make much difference.

    Anyone got any ideas?

    Thanks,
    Aquis

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,819
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The third parameter of the window.open call are suggestions only and browsers are free to ignore them. Many of the options there can be overridden by settings in the browser configuration so that individual users can choose whether to allow their browser to se the size etc for new windows.

    Removing the address bar or status bar lead to MAJOR security issues with computer systems since they allow address spoofing which can result in someone thinking they are on one web page when they are really on another. That is why most browsers now show those bars by default and in some cases don't even offer an option to turn themoff (since the browser authors don't wish to be held responsible if someone loses a million dollars due to not being able to see the address of the page that they are on). This is ONE of the 600 or so security holes in IE6 that has been plugged in IE7. There wont be a fix for it for the Mac because IE on the Mac was declared officially dead in 2003 and should no longer be used.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast Aquis's Avatar
    Join Date
    Jun 2006
    Location
    Uttoxeter, Staffordshire, UK
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is what I initially thought, however IE 7 correctly hides the address bar on some other sites, which is why I doubted it was this...however I am running this off of a password protected server (a kind of development sub-site). Could this be why it's not hiding the address bar? If so, I guess I don't have to worry about it being there when the site opens.

    Thanks,
    Aquis

  4. #4
    SitePoint Member
    Join Date
    Jan 2007
    Location
    Cologne, Germany
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would be interested which site have popups that don't show the location bar. As far as I know IE7 does show it generally

  5. #5
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah IE7 seems to show the address bar, but it's pretty unobtrusive and doesn't seem to be editable. Guess its the price we pay to protect those people who are so easily spoofed (come on, who really believes that someone they don't know in Africa is randomly contacting them...?).

    Dave

  6. #6
    SitePoint Enthusiast Aquis's Avatar
    Join Date
    Jun 2006
    Location
    Uttoxeter, Staffordshire, UK
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My mistake, IE7 always shows the address bar on any site! Oh well, thanks anyway!

    Aquis

  7. #7
    SitePoint Member
    Join Date
    Dec 2004
    Location
    Cumbria, UK
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I ran into this problem with our in-house system and solved it by adding the system to the Trusted Sites in each of the users' browsers


Bookmarks

Posting Permissions

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