473,327 Members | 2,016 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,327 software developers and data experts.

write to iframe in Opera

Hi all,

I create an IFrame and want to dynamically add content to it in Opera
(8.54) like this:

<html>
<body>
<script>
oPanel = document.createElement("IFRAME");
oPanel.src = "about:blank";
document.body.appendChild(oPanel);
oPanel.addEventListener("load", function(){
var oImage = oPanel.contentDocument.createElement("IMG");
oPanel.contentDocument.body.appendChild(oImage);
}, false);
</script>
</html>
</body>

I get the following error message:

-----
Event thread: load
Error:
name: Error
message: Security violation
-----

I learned about problems Opera has to not apply anti cross domain
policy when dealing with frames. But how to solve this? Any idea?

greetz

mord

Apr 16 '06 #1
2 3509


ju************@chello.at wrote:
I create an IFrame and want to dynamically add content to it in Opera
(8.54) like this:


With Opera 8.5 on Windows I managed that with an enforced delay using
setTimeout e.g.

var iframe = document.createElement('iframe');
iframe.addEventListener(
'load',
function (evt) {
var doc = iframe.contentDocument;
var p = doc.createElement('p');
p.appendChild(doc.createTextNode('Kibology for all.'));
doc.body.appendChild(p);
},
false
);
document.body.appendChild(iframe);
setTimeout(function () {
iframe.contentWindow.location.href = 'dummy.html';
}, 10);

where dummy.html simply has the basic
<htm><head><title></title></head><body></body></html> structure of an
HTML document.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 16 '06 #2
Martin,

Ingenious! Loading the iframe with a dummy which indicates it being
from the same domain, I just had to replace
oPanel.src = "about:blank";
with
oPanel.src = "dummy.html";
to make it work.
It was my ignorance about how browsers would deal with "about:blank"
(same with my other post about relative paths in iframes created with
"about:blank"

thanks a lot

Apr 16 '06 #3

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

Similar topics

13
by: gsb | last post by:
Object tag to write HTML page to via JavaScript? I've used iFrames and Objects to load web pages into another page. I want to do similar but not load a uri, rather write the page, <HTML>...
9
by: Arash Dejkam | last post by:
Hi All, Is it possible to write on an <OBJECT type="text/html"> using document.write() from within the html containing that tag the way we write on a popup window? I couldn't do that after a lot...
6
by: ok | last post by:
<img src="http://www.6park.com/enter2/av.gif" onload="document.write('an iframe obj');"> First of all, it destroy the HTML page. Secondly even if it does not destroy it, the iframe object will...
1
by: khothikhe | last post by:
Can someone help me here because this is really killing me! the problem is, i have this javascript code in my aspx page that i want it to work on almost all browsers, especially opera and safari...
5
by: Paul Fi | last post by:
Can someone help me here because this is really killing me! the problem is, i have this javascript code in my aspx page that i want it to work on almost all browsers, especially opera and safari...
6
by: Phlip | last post by:
JavaScripties: On the HTML side, we load an IFRAME with a blank page: <iframe frameborder="0" marginwidth="0" marginheight="0" scrolling="off" src="about:blank" id="iframe_xml1!format_text"...
1
by: Paul Fi | last post by:
can some one help me here coz this is really killing me! the problem is, i have this javascript code in my aspx page that i want it to work on almost all browsers, especially opera and safari : ...
8
by: '69 Camaro | last post by:
Perhaps I'm Googling for the wrong terms. Does anyone have links to examples of the syntax necessary to read the HTML on another Web page when that HTML is produced from JavaScript using the...
7
by: Tom Cole | last post by:
IFrames have been used by years for people to accomplish many of the tasks the XMLHttpRequest does for them now...I unfortunately am late in the game and XMLHttpRequest was already out there by the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.