Jump to content

iframe content


tendouser

Recommended Posts

Ok! It's for Google Chrome this issue.  Safari, IE, FF, Opera work fine.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>J</title>

<script type="text/javascript">

function changeStyle()

{

var x=document.getElementById("myframe");

var y=(x.contentWindow || x.contentDocument);

if (y.document)

    y=y.document;

y.body.style.backgroundColor="#0000ff";

}

</script>

</head>

<body onload="changeStyle()">

 

<iframe id="myframe" src="js1.htm">

<p>Your browser does not support iframes.</p>

</iframe>

<br /><br />

 

<input type="button" onclick="changeStyle()" value="Change background color" />

 

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/248656-iframe-content/#findComment-1277090
Share on other sites

I have both files in my PC.  The console outputs Unsafe JavaScript attempt to access frame with URL file:///C:/Documents%20and%20Settings/Administrador/Escritorio/js1.htm from frame with URL file:///C:/Documents%20and%20Settings/Administrador/Escritorio/js2.htm. Domains, protocols and ports must match.

 

Any idea?

Link to comment
https://forums.phpfreaks.com/topic/248656-iframe-content/#findComment-1277103
Share on other sites

One more question about this issue.  Does contentDocument() javascript method work on subdomains. 

I have this site http://www.binal.ac.pa/harias/series.htm and I load an iframe in each of this categories listed.  What I want to do with JS is to send a char via simulating a click and sending the char to the DB application.

 

Thanks for your comments!

 

And yes I'm using Chrome but now with Wamp localhost.

 

Link to comment
https://forums.phpfreaks.com/topic/248656-iframe-content/#findComment-1277804
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.