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