|
Posted by SpaceGirl on 10/07/05 01:02
Jonathan N. Little wrote:
> 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? ;-)
>
oops sorry
--
x theSpaceGirl (miranda)
# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
# this post (c) Miranda Thomas 2005
# explicitly no permission given to Forum4Designers
# to duplicate this post.
Navigation:
[Reply to this message]
|