dslreports logo
 
    All Forums Hot Topics Gallery
spc
Search similar:


uniqs
16121

luma9
Premium Member
join:2004-08-17
Port Coquitlam, BC

luma9

Premium Member

JS window.open works in FF but not in Safari

Hi all,

I have a little page that pulls up a report in a popup new window and I am having some browser compatibility issues :)

the code is:
<script language="javascript">window.open('reports/blahreport.html','','scrollbars=no,menubar=no,height=700,width=1000,resizable=yes,toolbar=no,location=no,status=no');</script>
 
I also tried:

<script language="javascript">
function popup( url, title, options )
  {
  var newWin = window.open( url, title, options )
  if( !newWin )
    {
    newWin = window.open('',title, options);
    newWin.location.href = url;
    }
  }
  
  popup("reports/blahreport.html","NewWindow","scrollbars=no,menubar=no,height=700,width=1000,resizable=yes,toolbar=no,location=no,status=no");
</script>
 

Any ideas?

Thank you

Luma
Graycode
join:2006-04-17

Graycode

Member

Do other popup windows work on your Safari? Maybe there's a config option to block popups.

luma9
Premium Member
join:2004-08-17
Port Coquitlam, BC

luma9

Premium Member

well it looks like Safari's popup blocker is set to just block popups, no warning, no message, no options, you have to manually going into options and enable them.

I guess I will have to include a message with a link, but I hate doing that, seems half arsed.

Luma

Gwellin
Premium Member
join:2004-05-31
Regina, SK

Gwellin

Premium Member

Yes, popup blockers will always be a problem, and for good reason. Have you looked in to the alternative, an overlay window? Something like GreyBox is not too difficult to set up with an iframe displaying whatever page you'd like (check out that first example link).

sporkme
drop the crantini and move it, sister
MVM
join:2000-07-01
Morristown, NJ

1 edit

sporkme to luma9

MVM

to luma9
This works for me in all versions of Safari with the pop-up blocker enabled. I don't even remember where I stole it from, but I don't think it does anything fancy:

<SCRIPT LANGUAGE='JavaScript'>
var newwindow;
function poptastic(url)
{
newwindow=window.open(url,'name','height=250,width=450,scrollbars=0,toolbar=0,menubar=0,location=0,resizable=1,status=1');
if (window.focus) {newwindow.focus()}
}
</SCRIPT>
 

What's safari's debug console have to say about the code you're using? There might just be something amiss in the syntax that's throwing it.

edit: oops, and this is how I call it:

<a href="javascript:poptastic('interval_usage.php?interval=5&ifindex=1995');">5 sec.</a>
 

I also see I'm doing it another way here where I need to pop when a button is pushed:

<form action='mrtg.php' target='MRTG' method='POST' onsubmit="window.open('','MRTG','resizable=1,scrollbars=0,width=500,height=250')">
<select name='mrtg'>
<option value='1' selected='selected'>yes</option>
<option value='0'>no</option>
</select><br>
<input type='submit' name='submit' value='submit'>
<input type='hidden' name='id' value='2969'>
</form>