www.webdeveloper.com
Results 1 to 3 of 3

Thread: Pop up coding to avoid browser blocking

  1. #1
    Join Date
    May 2012
    Posts
    3

    Pop up coding to avoid browser blocking

    I have a need to use a lot of pop ups to provide greater detail into items users are interested in.

    The problem is the percentage of time that a browser will block these pop ups.

    I would need to find a way to do one or both of two things:


    1.) Find a way to show pop ups like with lightbox that will not be blocked by browsers without greatly hindering page load time


    2.) Provide a JavaScript / JQuery alert that can detect when a pop up has been blocked by a browser and notify a user through an alert along with a custom message written by me





    Anyone familiar with some JavaScript coding that will do this or if lightbox is a practical solution without hindering page load time. There is likely to be anywhere from 10-30 different pop ups on a given page.

  2. #2
    Join Date
    Sep 2008
    Location
    Akron, OH
    Posts
    1,143
    Popup blockers will not block jQuery's lightbox.

  3. #3
    Join Date
    Sep 2006
    Location
    new york
    Posts
    267

    a couple of simple scripts

    I'm not an"expert" on this, but think pop-up will work if user initiates it by clicking link. (Of course, IE will block image rollovers if you don't click message at top of view-port.)

    There is always target="_blank" ("_new" loses focus)

    In any event, here are two scripts I've used for years. Recently, the "myopen" window has lost focus after first pop, but "loadpage" script keeps focus after several pops. Don't know what will happen if, indeed, HTML5 does not support new window "features" such as size?

    Code:
    // MYOPEN JavaScript Document 
    function myopen(url) { window.open (url, 'links', 'toolbar=0,location=1,directories=0,status=0,menubar=0,scrollbars=auto,resizable=yes,dependent=yes,width=400,height=400'); window.blur(); }
    
    var links; //to avoid "undefined" message
    
    // JavaScript Unleashed's onUnload event handler
    function clean() { 
    if (links != null) { links.close() }; 
    } 
    
    ===================
    
    // LOADPAGE JavaScript Document
    /*in BODY <a href="#nogo" onclick="loadpage('../things/___.jpg')">TEXT</a>*/
    
    var mypop=null;
    
    function loadpage(url) {
    if ((!mypop) || (mypop.close)) {
    mypop = window.open (url, 'mypop', 'width=400px,height=375px,toolbar=0,resizable=1,screenx=0,left=20,screeny=0,top=20');
    
    } else { mypop.document.location.href=url; }
    
    mypop.focus(); return true; 
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles