[Javascript] window.close () not catched

Guillaume javascript at webdesignofficina.com
Mon Apr 24 10:29:27 CDT 2006


Flávio,

> You said "window.close()" is not working when you change the image in 
> the second window, right?
> But if you just open and click the link it works?

Exactly...

>
> In IE we used to set "window.opener" to something not null when it 
> (IE) refused to close the window by "window.close()".

Or maybie give my opened window a name and then ask to close this 
particular window...
Here's the script I use to open the window to avoid using an inline script:

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;


This is how now I try to close it and that doesn't work once you browse 
images in this new window in Safari

<a href="#" onclick="window.close()">Close this window</a>

Obrigado Flavio...

Guillaume.




> May it be the same case?
>
> Ps.: I got no Safari to test here..
>
> Guillaume escreveu:
>
>> David Dorward wrote:
>>
>>> On Mon, Apr 24, 2006 at 04:24:46PM +0200, Guillaume wrote:
>>>  
>>>
>>>> Get rid of the JavaScript and decide user's already know how to close
>>>> windows - since they can do it for every other window on their system?
>>>>   
>>>
>>>
>>>  
>>>
>>>>   Since i'm proposing this link and it's working in all other 
>>>> browsers, I'd
>>>>   like not to waste Safari's users clics.
>>>>   
>>>
>>>
>>> If you get rid of the link you don't waste anyone's clicks, and get
>>> the bonus of extra space in the window.
>>>  
>>>
>>
>> Thanks, David I understand your idea and you are absolutely right... 
>> But I really don't want to start arguing over my choices, the fact 
>> that I need this option and that throwing my problem in the garbage 
>> can is not the kind of JavaScript solution I was expecting...
>> Besides I just can't explain you in this mail the structure of my 
>> page and the need I have to preserve this link...
>>
>> So let's talk JavaScript again... Any other solution ?
>>
>> Guillaume.
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Javascript mailing list
>> Javascript at LaTech.edu
>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>  
>>
>




More information about the Javascript mailing list