• Welcome to Valhalla Legends Archive.
 

Modifying iframes with Javascript

Started by iago, October 17, 2004, 09:41 AM

Previous topic - Next topic

iago

I tried to do something like this:

<iframe src="http://www.google.ca" name="test"></iframe>

<input type="button" value="click me" onclick="
test.src='http://www.valhallalegends.com'">


When I click the button, the javascript console says:
Error: uncaught exception: Permission denied to set property Window.src

Is there any way to set the src attribute of an iframe?
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Zorm

try
onclick="parent.test.location.href='http://www.valhallalegends.com/';"
"Now, gentlemen, let us do something today which the world make talk of hereafter."
- Admiral Lord Collingwood

iago

Aha, this worked beautifully:

<html>

<input type="button" value="test" onclick="parent.test.location.href='http://www.valhallalegends.com/';"><br><br>
                         
This is my test iframe:<br>     
<iframe src="http://www.google.ca" name=test></iframe><br>

</html>


Thanks, zorm!
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*