how does IE's pop up blocker work ?

Post March 28th, 2005, 12:06 pm

i was planning a script for a send-to-friend function on my website. So people could email to themselves or others a link to articles.

Instead of loading a fresh page, i decided to use a pop up window and it got me thinking : how can i be sure IE wont block it from opening ?

95% of my visitors use Internet Explorer, so i need to be make sure :?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post March 28th, 2005, 12:06 pm

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 22454
  • Loc: Pittsburgh PA
  • Status: Offline

Post March 28th, 2005, 12:23 pm

I.E. doesn't have a popup blocker. If there is one in use it will be a third party program like Google's toolbar.

However, many people are learning to add pop-up blockers so there is no garantee
"The web is a dominatrix. Every where I turn, I see little buttons ordering me to Submit."
Play sports pools and discuss sports topics at Boasting Rights Sports Forum
Get paid to write articles - www.associatedcontent.com

Post March 28th, 2005, 12:27 pm

with Service Pack 2, Microsoft added a pop up blocker to windows XP

here's the link : http://www.microsoft.com/windowsxp/usin ... ocker.mspx

but you seem to be right. From what i've been reading on the issue i can't be sure of anything
  • Vladdrac
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Feb 04, 2004
  • Posts: 2138
  • Loc: Louisville, Ky
  • Status: Offline

Post March 28th, 2005, 12:36 pm

important to note as well, a lot of these popup blockers and tool bars give you the option to allow pop ups from a particular site, as well as see what the popup that was blocked was. In my experience, if I go to a site that is supposed to give me a popup link for say a download or such, i go to it from there.
  • joebert
  • Weathered
  • Genius
  • User avatar
  • Joined: Feb 10, 2004
  • Posts: 11817
  • Loc: Clearwater, FL
  • Status: Offline

Post March 28th, 2005, 3:39 pm

By default most popup blockers allow popups triggered by the user, (clicks, ect..)

At the same time alot of people set their blockers to high security which blocks even user triggered popups.

You can do a simple check to see if your popup was blocked & toggle the display of a hidden DIV giving instructions on what to do when a popup was blocked.

Here's an example of this,
Code: [ Download ] [ Select ]
<html>
<head><title>Popup check</title>

<script type="text/javascript">
function check_popup(){
    try{
        email_popup.focus();
    } catch(e){
        document.getElementById("popup_div").style.display = "block";
        window.location = "#popup_warning";
    }
}
window.onload = function(){
    email_popup = window.open("index.html");
    window.setTimeout("check_popup()", 500);
}
</script>
</head>

<body>
<div>
    <div id="popup_div" style="color:red; font-size:15px; display:none;">
        <a name="popup_warning">&nbsp;</a>
        A popup required to send the email was blocked, please enable popups for this site or <a href="index.html">Click Here</a> to continue.
    </div>
    Main content
</div>
</body>
</html>
  1. <html>
  2. <head><title>Popup check</title>
  3. <script type="text/javascript">
  4. function check_popup(){
  5.     try{
  6.         email_popup.focus();
  7.     } catch(e){
  8.         document.getElementById("popup_div").style.display = "block";
  9.         window.location = "#popup_warning";
  10.     }
  11. }
  12. window.onload = function(){
  13.     email_popup = window.open("index.html");
  14.     window.setTimeout("check_popup()", 500);
  15. }
  16. </script>
  17. </head>
  18. <body>
  19. <div>
  20.     <div id="popup_div" style="color:red; font-size:15px; display:none;">
  21.         <a name="popup_warning">&nbsp;</a>
  22.         A popup required to send the email was blocked, please enable popups for this site or <a href="index.html">Click Here</a> to continue.
  23.     </div>
  24.     Main content
  25. </div>
  26. </body>
  27. </html>

The logic behind this is that the variable email_popup will not exist if the popup was blocked, when you try to focus the window with email_popup.focus() it will raise a javascript error since the reference to that popup window doesn't exist. Wrapping that focus() inside a try/catch will suppress the error & allow you to toggle that hidden information area :D

Post March 28th, 2005, 6:08 pm

I found this javascript code after reading an article on A List Apart

Code: [ Download ] [ Select ]
<script type="text/javascript" src="send_link/lib.js"></script>
    <script type="text/javascript" src="send_link/popup.js"></script>
    <script type="text/javascript" >
    
// redefining default features
var _POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,width=275,height=450';

listen('load', window, function() {
    mlisten('click', getElementsByClass('popup','a'), event_popup );
});

    </script>
  1. <script type="text/javascript" src="send_link/lib.js"></script>
  2.     <script type="text/javascript" src="send_link/popup.js"></script>
  3.     <script type="text/javascript" >
  4.     
  5. // redefining default features
  6. var _POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,width=275,height=450';
  7. listen('load', window, function() {
  8.     mlisten('click', getElementsByClass('popup','a'), event_popup );
  9. });
  10.     </script>

I crancked up IE's blocker to High security and tried it out.

Surprise, IE does block it, forcing the document to open in the current window.

the link code is
Code: [ Download ] [ Select ]
<a href="http://www.ncs.iscsp.utl.pt/send_link/friend.php?id=/teste.php " class="popup"> enviar link </a>

it's not the ideal way, but as long as it works, i'm happy :)
  • logoleptic
  • Novice
  • Novice
  • User avatar
  • Joined: Mar 25, 2005
  • Posts: 31
  • Loc: Kansas, USA
  • Status: Offline

Post March 29th, 2005, 6:31 am

QuietStorm wrote:
I crancked up IE's blocker to High security and tried it out.

Surprise, IE does block it, forcing the document to open in the current window.


If you set IE's popup blocker on high it will block everything no matter what, with Ctrl+click being the override for this behavior. Of course, you can never tell when someone might visit your page with settings turned up to max, so the accessible approach you mentioned from ALA is good and sound.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 76 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.