Reply to Re: script to open a new window

Your name:

Reply:


Posted by Jonathan N. Little on 12/15/35 11:28

Gérard Talbot wrote:

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

You are correct, however my intention was not to create a complete
solution for him but to illustrate where his trouble lay:

<a href='javascript:window.open('www.wedgwood-group.com/'...

would return a window object when clicked, destroying the calling window.

Yes adding focus to new window would help, better yet, don't do a popup
at all(many here would advocate that).




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

That OP choice not mine, as said just addressing his problem/
>
> 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

Yep your could add 'target="bob"' to link so javascript disable browsers
will open new window, and then DOCTYPE will be 4.01 transitional too,
right? ;-)

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

[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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация