Skip to content

Instantly share code, notes, and snippets.

@vagdwd
Last active March 25, 2021 01:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vagdwd/c6a0a608a58675855ed5 to your computer and use it in GitHub Desktop.
Save vagdwd/c6a0a608a58675855ed5 to your computer and use it in GitHub Desktop.
Iframe without src attribute - javascript vs about:blank vs #
javascript:false:
IE10 and FF (checked in v23 in Linux) will show 'false' as content.
javascript:void(0) && javascript:;:
IE will show 'cannot display the webpage' error in the iframe. Also, when setting the src from a valid url to javascript:void(0), the page will not get blank.
about:blank:
Works in all browsers but IE 9 sends an request to the server with path "null". Still the best bet IMO
Checkout http://jsfiddle.net/eybDj/1
Checkout http://jsfiddle.net/sv_in/gRU3V/ to see how iframe src changes on dynamic updation with JS
source: http://stackoverflow.com/questions/4284605/iframe-without-an-src-attribute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment