473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Dynamic IFRAME creation

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!

Apr 3 '07 #1
1 6864
On Apr 3, 3:23 pm, "redbaks" <redb...@gmail.comwrote:
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?

Apr 10 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Csaba2000 | last post by:
I want to be able to embed a single quote into an INPUT element within a dynamically generated IFRAME. The example below shows how the IFRAME is generated. Challenge: I'd like the alert box to...
5
by: Tompa | last post by:
Hi, I would like to create images on the fly as a response to an http request. I can do this with PIL like this (file create_gif.py): from PIL import Image, ImageDraw print 'Status: 200 OK'...
1
by: andrew queisser | last post by:
I've been trying to dynamically create a class DevT that's derived from a generic base GenBase<T>. It doesn't seem to work. I'm attaching a code sample below that illustrates the problem. ...
2
by: charliewest | last post by:
I need to create textboxes in real-time, the actual number of which is determine by a result from a database query. I have been able to create the controls, and then add them to the ASPX page....
8
by: hyejin | last post by:
I have a problem with dynamic iframe and document.close() on Firefox. Below two files create a dynamic iframe by JavaScript. These two samples do not have any problems on IE. But, on Firefox, the...
1
by: mike888 | last post by:
I want to create dynamic iframe content like below but in Firefox <iframe width="100%" height="100" src="#"></iframe> <script language="JavaScript"><!-- document.frames.document.open();...
3
polymorphic
by: polymorphic | last post by:
I have succeeded in embedding PDF files in a dynamic iframe. The problem is that I need the PDF to cache. If the PDF remains the same from page load to page load then the pdf is somehow cached with...
1
by: cdmsenthil | last post by:
I have an Infragistics UltrawebGrid . Each Row in the grid is attached to a context menu using Infragistics CSOM Upon click on the menu, I am creating an Iframe dynamically which points to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.