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.
精彩评论