Alex Rivera | Logout

iframe without an src attribute

Asked 2010-11-26T10:49:04.030
25

I would like to create an <iframe> on the page, but then add the src later. If I make an iframe without an src attribute, then it loads the current page in some browsers. What is the correct value to set for the src so that it just loads a blank iframe?

The answers I've seen are:

  • about:blank
  • javascript:false
  • javascript:void(0)
  • javascript:"";
  • url to a blank page

Is there a clear winner? If not, what are the tradeoffs?

I'd like to not have mixed content warnings for HTTPS urls, nor any back-button, history, or reload weirdness in all browsers from IE6 onward.

Edit
Report

2 Answers

10

Not sure if all browsers support "about:blank", so I'd just go with your own blank page then.

Another idea: Why not add the whole iframe using javascript instead of just the src?

answered 2010-11-26T10:52:59.463
6

What about

about:blank
answered 2010-11-26T10:54:05.593

Your Answer