f



windows safari and windows

Testing locally on an Win XP box with the safari pop up blocker disabled:

window.close();
will close the window without warning even though the window was not 
opened by javascript.

win = window.open("test.htm","foo");//, str);
alert(win);
does not open a new window and the value displayed by the alert is 
"undefined" (shouldn't it be "null" if there was a problem???). Also 
safari's activity window doesn't show any problems encountered.

If I put a link on the page
<a href="test.htm" target="_blank">click here</a>
then when you click the link it does open a new window.

How do I get windows safari to open new window with javascript from an 
onclick event?

Andrew Poulos
0
Andrew
6/13/2007 11:18:04 PM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

2 Replies
1298 Views

Similar Articles

[PageSpeed] 4

Andrew Poulos said the following on 6/13/2007 7:18 PM:
> Testing locally on an Win XP box with the safari pop up blocker disabled:
> 
> window.close();
> will close the window without warning even though the window was not 
> opened by javascript.
> 
> win = window.open("test.htm","foo");//, str);
> alert(win);
> does not open a new window and the value displayed by the alert is 
> "undefined" (shouldn't it be "null" if there was a problem???). Also 
> safari's activity window doesn't show any problems encountered.
> 
> If I put a link on the page
> <a href="test.htm" target="_blank">click here</a>
> then when you click the link it does open a new window.
> 
> How do I get windows safari to open new window with javascript from an 
> onclick event?

Submit a bug report and wait on it to get out of Beta.

-- 
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
0
Randy
6/13/2007 11:33:52 PM
Andrew Poulos wrote:
> Testing locally on an Win XP box with the safari pop up blocker disabled:
> 
> window.close();
> will close the window without warning even though the window was not 
> opened by javascript.
> 
> win = window.open("test.htm","foo");//, str);
> alert(win);
> does not open a new window and the value displayed by the alert is 
> "undefined" (shouldn't it be "null" if there was a problem???). Also 
> safari's activity window doesn't show any problems encountered.

No, I expect undefined.  null would be in the case of the variable not 
existing in Safari.  undefined at least tells you that it sees the 
variable, the variable just has no value.

> If I put a link on the page
> <a href="test.htm" target="_blank">click here</a>
> then when you click the link it does open a new window.
> 
> How do I get windows safari to open new window with javascript from an 
> onclick event?

I see your problem.  I noticed the same thing, for example:

<p onclick="window.open('safari.htm', 'safari_win', 
'width=200,height=200');">named</p>

....does not work, whereas:

<p onclick="window.open('', 'safari_win', 
'width=200,height=200');">unnamed</p>

....works just fine.  Of course this begs the question, how the hell can 
that be useful?  I don't know.

I do know that you can post to a new window successfully, but not open 
an existing document or URL.  At least not in the fashion previously 
discussed.

I think what Randy said is probably the most helpful at this point.

-- 
-Lost
Remove the extra words to reply by e-mail.  Don't e-mail me.  I am 
kidding.  No I am not.
0
Lost
6/14/2007 12:34:46 PM
Reply: