Does about:blank work in all browsers?

别说谁变了你拦得住时间么 提交于 2019-12-09 14:02:11

问题


I have an iframe and I want to clear it, so I set its src to about:blank

Then I wondered, does this work in all browsers?


回答1:


It's a requirement for HTML5 implementations to support about:blank.

As for non-HTML5 web browsers, it depends. WorldWideWeb, Lynx, and some other browsers don't support about:blank – it wasn't a standard then. The about:blank itself initially appeared in Netscape Navigator 1. Internet Explorer copied that feature from Netscape, and other browsers copied it as well. If the browser supports frames, you can be almost sure it supports about:blank. Otherwise websites using frames with about:blank location created when Netscape was popular would show errors (or not show them, and effectively do what you wanted).




回答2:


One thing to be aware of is that if you are running a website in https, you need to be careful about blanking out an iframe. about:blank is a non-secure page and so the browser will throw an error to the user that there are non-secure sections of the page if you have an iframe sourced to about:blank.

(Not exactly an answer to your question, but I thought it was worth mentioning)




回答3:


Yes, it works in the following browsers:

Mozilla Firefox

Opera

Internet Explorer

Konqueror

Safari

Google Chrome

MSN Explorer




回答4:


It is safe to use in all browsers I know of, but, from the Wikipedia article:

It is not an officially registered scheme, and has no standard syntax.

There is no guarantee this will be accepted as a valid URL by all clients.

I would be interested to hear about an "empty URL" approach that is guaranteed (by the spec) to work everywhere.




回答5:


I dont know if ALL browser use it, but I know the following does:

  • Firefox
  • Safari
  • Chrome
  • Internet Explorer

Which are the main ones I would say.




回答6:


should so, yes.



来源:https://stackoverflow.com/questions/4145245/does-aboutblank-work-in-all-browsers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!