You are here: Re: script to open a new window « HTML « IT news, forums, messages
Re: script to open a new window

Posted by Gιrard Talbot on 11/17/46 11:28

Jonathan N. Little a Γ©crit :
> Jackmac wrote:
>
>> Hi all,
>>
>> Hopefully an easy one for someone.
>>
>> I'm trying to set up a link on my web pages which will allow me to
>> open a new window of a specific size. Got that to work without a
>> problem. The difficulty I have is that when you close the new window
>> you've opened, instead of having the page you cliked from, you see a
>> page with... [object] on it.
>>
>> The page concerned is:
>>
>> http://www.independentproducts.co.uk/test.htm
>>
>> Any ideas anyone please?
>>
>> TIA
>>
>> Jackmac
>>
> That's because window.open() return a reference to the new window which
> to put in the href of the link.
>
> <a href="javascript:foobar();">
>
> is a bad idea, what happens if the user has javascript disabled?
>
> better:
>
>
> JavaScript:
> function popup(url){
> var newwin=window.open(url,'bob','WIDTH=320,HEIGHT=195');
> return false; //so if javascript IS enabled prevents link on page
> }
>

If the window is already opened, then the user will still be clicking on
the link and the secondary window will not be brought up on top. This is
a very frequent and major usability problem with secondary window and
your code does not address this issue.

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


> HTML:
> <a href='http://www.wedgwood-group.com/'
> onclick="return popup('http://www.wedgwood-group.com/')">
> Click to download
> </a>

The popup will be non-resizable and will not render scrollbar(s) if
content overflows requested window dimensions; in both cases, this is
not user friendly and is not usable.

Also, if javascript is disabled, then the link will not be loaded in the
"bob" secondary window. Your code creates 2 sorts of behavior depending
on javascript support enabled/disabled.

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

GΓ©rard
--
remove blah to email me

 

Navigation:

[Reply to this 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

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