What is the difference between “[removed]”, “#”, a

2019-05-27 12:14发布

问题:

If I want to set the src of iframe with these 3 value. I found:

  1. javascript: doesn't work in IE10 (error is can't find the page). other mainstream browsers or IE9 is ok.
  2. javascript:false will show a false string in the iframe for IE10, others browsers or IE9 is ok.
  3. # works fine in all the browsers.

What is the difference between them? Which one is the best choice for cross-browser issues?

回答1:

Try using about:blank as the URL. This should display a blank page in all browsers.

http://tools.ietf.org/html/rfc6694#section-3



回答2:

If you want an iframe that doesn't load anything right away, then just don't set the src attribute to anything. You can set the .src property later via Javascript to cause it to load something.