...

View Full Version : Looking for "Sizeable" Popup that will work in google chrome



DataTalk
12-28-2010, 06:15 PM
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



<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


onclick=popup(mypage.php?id=".$row->id."

Old Pedant
12-29-2010, 12:44 AM
This can't be right:

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

echo ' onclick="popup(\'mypage.php?id=' . $row->id . '\')" ';

DataTalk
12-29-2010, 03:35 AM
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



<?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>";
}
?>

Old Pedant
12-29-2010, 03:54 AM
There's no guarantee that's going to work without the "..." after onclick.

I'd do it this way:


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.

DataTalk
12-29-2010, 04:39 AM
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...



echo "<input type='image' onclick=\"popup('qw_library_view.php?id=" . $id . "')\"
target='_blank' src='static/icon16/view.jpg' style='width: 16; height: 12'>";

DataTalk
12-29-2010, 05:06 AM
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!



<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>

DataTalk
12-30-2010, 02:52 AM
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?

DJCMBear
12-30-2010, 03:15 AM
This does work in chrome, your just setting the width and height to big.

Try making the width and height smaller like this.


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;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum