Dynamic IFRAME creation

R

redbaks

Hi! I am trying to implement adding widgets to our template editor
(for blogs). I am worried that i might open a window for XSS attacks
so i decided to enveloped all widgets inside an iframe.

whenever a user wants to insert an external widget to his blog, a
script takes over and it will create a dynamic iframe and then the
widget script will be inserted inside the iframe.

i created a dynamic iframe using this code (I simplified it..)

<script>
<!--
function addWidget(code) {
var IFR =document.createElement('iframe');
IFR.name = IFR.id = "iframe-" + new Date().getTime();
IFR.src = "javascript: '<html><head></head><body>" +code + "</body></
html>'";
document.body.appendChild(IFR);
}
</script>

it works fine on most of the widgets, but i am getting problems adding
Google Gadgets.
My questions are:
1. Are there any other way to create a dynamic and passing a dynamic
content on the fly?
2. Is this safe enough or i am a little paranoid on doing this extra
work framing every widgets?


Thanks guys!
 
R

redbaks

Hi! I am trying to implement adding widgets to our template editor
(for blogs). I am worried that i might open a window for XSS attacks
so i decided to enveloped all widgets inside an iframe.

whenever a user wants to insert an external widget to his blog, a
script takes over and it will create a dynamic iframe and then the
widget script will be inserted inside the iframe.

i created a dynamic iframe using this code (I simplified it..)

<script>
<!--
function addWidget(code) {
var IFR =document.createElement('iframe');
IFR.name = IFR.id = "iframe-" + new Date().getTime();
IFR.src = "javascript: '<html><head></head><body>" +code + "</body></
html>'";
document.body.appendChild(IFR);}

</script>

it works fine on most of the widgets, but i am getting problems adding
Google Gadgets.
My questions are:
1. Are there any other way to create a dynamic and passing a dynamic
content on the fly?
2. Is this safe enough or i am a little paranoid on doing this extra
work framing every widgets?

Thanks guys!

anything guys?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top