Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting iFrame src attribute as encoded data URI with javascript in chrome

I am trying to code an iFrame to act as a test area in an in-browser HTML/Javascript/CSS IDE in chrome, but I am losing a lot of functionality due to certain bugs, and I was wondering if someone could tell me how to set the .src attribute of the iFrame to a URL with the html Javascript CSS etc code encoded directly in the .src attribute. Don't tell me it can't be done, because I know it can, I just lost the web page where I found this method. Also, as a side note, would it be possible to programmatically force this iFrame to refresh?

Thank you for your time,

Chris

like image 958
chrismamo1 Avatar asked Dec 11 '11 19:12

chrismamo1


1 Answers

From my research it looks like this has been deemed a security risk and so is disallowed in all browsers.

MS IE site link excerpt:

Data URIs are supported only for the following elements and/or attributes.

  • object (images only)
  • img
  • input type=image
  • link
  • CSS declarations that accept a URL, such as background, backgroundImage, and so on.

HTML5 Security Cheatsheet: http://html5sec.org/

like image 157
rushkeldon Avatar answered Sep 29 '22 09:09

rushkeldon