473,624 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.creat eElement('ifram e');
IFR.name = IFR.id = "iframe-" + new Date().getTime( );
IFR.src = "javascript : '<html><head></head><body>" +code + "</body></
html>'";
document.body.a ppendChild(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 6884
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.creat eElement('ifram e');
IFR.name = IFR.id = "iframe-" + new Date().getTime( );
IFR.src = "javascript : '<html><head></head><body>" +code + "</body></
html>'";
document.body.a ppendChild(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
9359
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 show: Mom said, "Don't" instead of the current: Mom said, "Do not". The point of the exercise is that I will be passing arbitrary strings to the IFRAME and I want to ensure that the final string is the same as the original. So I'm interested...
5
4387
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' print 'Content-type: text/html' print print '<HTML><HEAD><TITLE>Python Dynamic Image Creation Test</TITLE></HEAD>'
1
2131
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. CreateType() fails when the base class is a parametrized class, as in DevT : GenBase<int>. CreateType() works if the base class is not parametrized, even if the base of the base was parametrized, as in DevT : GenBaseInt : GenBase<int>
2
16239
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. However, when i submit the page, i am unable to read the values entered in these new textboxes. I have first tried to use System.Web.UI.WebControls.TextBox namespace, however, i was unable to read any value from my textboxes using the following...
8
5359
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 icon on the top corner keeps running with "loading" message on the bottom status bar even though the browser completed everything in the iFrame. The line that causes the problem is "document.close()" in the included JS file. If this line is...
1
5368
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(); document.frames.document.write('THis is the dynamic text for iframe above'); document.frames.document.close();
3
5379
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 the html page. But if I try to navigate to another pdf in the IFRAME then no caching occurs. Is the problem in the IFRAME reloading instead of just refreshing the pdf? <SCRIPT type="text/javascript"> var pageNo; var nav; var iframe; var...
1
4887
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 another page in the same domain which also contains infragistics datagid populated with default data retrieved from Data Base. After creating the frame I am attaching it to the HTML DOM and show it as modal popup with OK and Cancel Button inside an...
0
8179
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8685
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8348
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7176
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6112
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4187
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1797
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1493
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.