Results 1 to 4 of 4

Thread: Javascript popup function compatibility with browsers

  1. #1
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Javascript popup function compatibility with browsers

    Hi..
    Could someone tell me if the "popup" javascript function i used is compatible with all the internet browsers available like firefox,IE...etc..

    plz reply asap...
    Thnx

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,070
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Which pop up did you use?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=300,left = 192,top = 144');");
    }

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,070
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Works OK here in IE6 and FF and should be fine in most browsers. If a pop up of this sort is not launched as a direct result of a user's click, it often will be blocked by many browsers though. Here are two link codes I used to launch it:
    HTML Code:
    <a href="javascript:popUp('some.htm')">Link Text</a>
    HTML Code:
    <a href="some.htm" onclick="popUp(this.href);return false;">Link Text</a>
    Both of the above were not blocked as they require a user's direct click to activate. The second one has the advantage of loading the page in the current window if the user has no javascript available/active. This one:
    HTML Code:
    <a href="some.htm" target="_blank" onclick="popUp(this.href);return false;">Link Text</a>
    Will launch the content in a regular new window if there is no javascript for the user.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •