开发者

simple javascript close window, no jquery or any other framework

开发者 https://www.devze.com 2023-01-12 18:08 出处:网络
I\'m trying to write a simple javascript(no jquery or any other framework) which should automatically close the browser window or tab (if it\'s open开发者_运维百科 in a tab). I found a lot of examples

I'm trying to write a simple javascript(no jquery or any other framework) which should automatically close the browser window or tab (if it's open开发者_运维百科 in a tab). I found a lot of examples over the internet but I couldn't find a reliable solution( some of them don't work with IE) . If it's not possible to close the window directly without the client action a simple link to click on would be good too . So far I have this

<a href="javascript: self.close()">Close Window</a>


The code you posted will work fine, except you can only close windows that were opened by your script (by window.open). There's no way you can close a window/tab that the user manually opened.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号