开发者

close a windows if a page is 404

开发者 https://www.devze.com 2023-02-19 11:59 出处:网络
if a page is not found, i want a scr开发者_StackOverflow社区ipt to close the window by itself. I have no idea about how to start..a little bit of guide will be gratefulI agree with @deceze\'s comment

if a page is not found, i want a scr开发者_StackOverflow社区ipt to close the window by itself.

I have no idea about how to start..a little bit of guide will be grateful


I agree with @deceze's comment on your question. I'm not sure why you would want to close the window.

Technically speaking, it's possible to do.

If you control the website, you could alter the 404 page to perform a JavaScript window.close() although there are certain restrictions which are discussed here.

If you don't own the page, I suppose the only other way you could do it would be to write an extension/add-on/plug-in/doohickey for your browser. Again I'm not aware of any.

Assuming it's for a website that you control though, the normal practice isn't to close the window if your server sends a 404 but to instead provide positive feedback to the user.

Have a look at this article for some 404 best-practices.

0

精彩评论

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

关注公众号