Reply to Re: Javascript window.open fails in IE

Your name:

Reply:


Posted by Gιrard Talbot on 09/20/05 06:16

gleverett@gmail.com a Γ©crit :
> I have been searching the 'Net, and I can't find the right solution
> here. I am writing some PHP pages that utilize some Javascript. The
> script works in Mozilla/Netscape, but fails in IE. I don't know if
> it's the Javascript or the PHP that is causing the problem. I started
> with an example in a book and added on.
>
> The script I'm using is:
>
> <SCRIPT LANGUAGE="Javascript" TYPE="text/javascript">

language attribute is deprecated.

> <!--

HTML comment is not needed here.

> function open_window(url) {
> var NEW_WIN = null;
> NEW_WIN = window.open ("", "Record Viewer", "toolbar=no,width=<?php

Right here. The window name should be a one string without blank space.

http://developer.mozilla.org/en/docs/DOM:window.open


> echo $new_win_width ?>,height=<?php echo new_win_height
> ?>,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no")

If the windowFeatures string list is not empty, then you only need to
set the features which will be on, enabled.

;
> NEW_WIN.location.href = url;

I never understood why people code like that. Why not define the url in
the window.open() call?

> }
>
> //-->
> </SCRIPT>
>
> (I added some line break to make it readable The NEW_WIN line is all
> on one line.)
>
> The PHP variables get added correctly, and the two calls from the PHP
> program are similar to:
>
> <a
> href="javascript:open_window('$PHP_SELF?action=action1');\">Action1</a>
>


"javascript:" pseudo-protocol is definitely not recommendable.

http://jibbering.com/faq/#FAQ4_24

http://developer.mozilla.org/en/docs/DOM:window.open#Never_use_this_form_of_code_for_links:.3Ca_href.3D.22javascript:window.open.28....29.22_....3E
"
* "javascript:" pseudo-links become dysfunctional when javascript
support is disabled or inexistent. Several corporations allow their
employees to surf on the web but under strict security policies: no
javascript enabled, no java, no activeX, no Flash. For various reasons
(security, public access, text browsers, etc..), about 8% to 12% of
users on the web surf with javascript disabled.
* "javascript:" links will interfere with advanced features in
tab-capable browsers: eg. middle-click on links, Ctrl+click on links,
tab-browsing features in extensions, etc.
* "javascript:" links will interfere with the process of indexing
webpages by search engines.
* "javascript:" links also interfere with assistive technologies
and several web-aware applications (e.g. PDA).
* Protocol scheme "javascript:" will be reported as an error by
link validators and link checkers.
"

GΓ©rard
--
remove blah to email me

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация