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 8 of 8
  1. #1
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts

    Looking for "Sizeable" Popup that will work in google chrome

    Does anyone have a sizeable popup that will work in google chrome??

    I have tried several scripts for this with no success, they all open full page..

    Here is an example of what I am looking for...

    The problem with this is it opens a new page plus a full page popup

    Code:
    <script type="text/javascript">
    <!--
    function popup(url) 
    {
     var is_chrome; 
     var width  = 1020;
     var height = 600;
     var left   = (screen.width  - width)/2;
     var top    = (screen.height - height)/2;
     var params = 'width='+width+', height='+height;
     params += ', top='+top+', left='+left;
     params += ', directories=no';
     params += ', location=no';
     params += ', menubar=no';
     params += ', resizable=yes';
     params += ', scrollbars=yes';
     params += ', status=no';
     params += ', toolbar=no';
     newwin=window.open(url,'windowname5', params);
     is_chrome= navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
     if (is_chrome) {newwindow.parent.blur();}
     if (window.focus) {newwin.focus()}
     return false;
    }
    // -->
    </script>
    To open I am using
    Code:
    onclick=popup(mypage.php?id=".$row->id."
    Last edited by DataTalk; 12-30-2010 at 02:01 AM.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,193
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    This can't be right:
    Code:
    onclick=popup(mypage.php?id=".$row->id."
    You don't have any kinds of quotes around the call to popup or around the URL.

    I'm assuming you are using echo in PHP for this?

    so
    Code:
         echo ' onclick="popup(\'mypage.php?id=' . $row->id . '\')" ';
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Sorry! I just assumed, and I know....we cant read minds here... my bad...

    Sure could use some help with this popup in chrome...
    As I mentioned, This opens as full page

    Code:
    <?php
    sql = select ("read my mind from here, while loop, and the result") ;
    // now lets view the output
    echo "<input type='image' onclick=popup('qw_library_view.php?id=".$row->id."'); 
             target='_blank' src='static/icon16/view.jpg' style='width: 16; height: 12' >
             <b>$row->doc_name</b>";
    }
    ?>
    Last edited by DataTalk; 12-29-2010 at 02:41 AM.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,193
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    There's no guarantee that's going to work without the "..." after onclick.

    I'd do it this way:
    Code:
    echo '<input type="image" onclick="popup(\'qw_library_view.php?id=' . $row->id. '\')" '
       . ' target="_blank" src="static/icon16/view.jpg" style="width: 16; height: 12" >'
       . '<b>' . $row->doc_name . '</b>';
    But then bring up the page in the browser and do a VIEW==>>SOURCE and tell us what it looks like in the browser.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Thanks for your help, That code eliminated the second window poping up but I had to edit it
    to work without an error as seen below...

    The popup works in all browsers except for google chrome..
    The page opens in google chrome ok but does not open to requested size...

    Code:
    echo "<input type='image' onclick=\"popup('qw_library_view.php?id=" . $id . "')\" 
    target='_blank' src='static/icon16/view.jpg' style='width: 16; height: 12'>";
    Last edited by DataTalk; 12-30-2010 at 01:59 AM.

  • #6
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    I just edited my main page which has the popup script with no other apps running "plain and simple", and tried opening a page with just plain text....
    Still opens chrome with full page!!

    Here is my revised code!
    Code:
    <html>
    <head>
    <title>Test Google Chrome Sizeable Popup</title>
    <script type="text/javascript">
    <!--
    function popup(url) 
    {
     var is_chrome; 
     var width  = 1020;
     var height = 600;
     var left   = (screen.width  - width)/2;
     var top    = (screen.height - height)/2;
     var params = 'width='+width+', height='+height;
     params += ', top='+top+', left='+left;
     params += ', directories=no';
     params += ', location=no';
     params += ', menubar=no';
     params += ', resizable=yes';
     params += ', scrollbars=yes';
     params += ', status=no';
     params += ', toolbar=no';
     newwin=window.open(url,'windowname5', params);
     is_chrome= navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
     if (is_chrome) {newwindow.parent.blur();}
     if (window.focus) {newwin.focus()}
     return false;
    }
    // -->
    </script>
    </head>
    
    <body>
    <?php
    $id = "129";
    echo "<input type='image' onclick=\"popup('qw_library_view.php?id=" . $id . "')\" 
          target='_blank' src='static/icon16/view.jpg' style='width: 16; height: 12' >";
    ?>
    </body>
    
    </html>
    Last edited by DataTalk; 12-30-2010 at 02:06 AM.

  • #7
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Still looking for an answer on a sizeable popup that will work
    in google chrome?? has anyone experienced trouble with this??
    and, Is there a solution?
    Last edited by DataTalk; 12-30-2010 at 02:08 AM.

  • #8
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts
    This does work in chrome, your just setting the width and height to big.

    Try making the width and height smaller like this.
    Code:
    function popup(url) {
      var width  = 500,
          height = 300,
          left   = (screen.width  - width)/2,
          top    = (screen.height - height)/2,
          params = 'width='+width+', height='+height+
                   ', top='+top+', left='+left+
                   ', directories=no'+
                   ', location=no'+
                   ', menubar=no'+
                   ', resizable=yes'+
                   ', scrollbars=yes'+
                   ', status=no'+
                   ', toolbar=no',
          newwin = window.open(url,'windowname5', params),
          chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
      if(chrome) {newwin.parent.blur();}
      if(window.focus) {newwin.focus();}
      return false;
    }
    Official BinPress hand picked coder.
    For anyone worried about SQL injection go have a look at my small yet powerful script here.
    Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
    I am 1 of 65,608 people to get a Pebble Watch :P


  •  

    Posting Permissions

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