Diferència entre revisions de la pàgina «Solució exercici accès prohibit»
De wikiserver
(Es crea la pàgina amb «<pre> <iframe src="http://google.com" name="google" style="height:100px"></iframe> <script> document.getElementsByName('google')[0].onload = function() { try { aler…».) |
|||
| (3 revisions intermèdies per 2 usuaris que no es mostren) | |||
| Línia 1: | Línia 1: | ||
| − | < | + | <source lang="javascript"> |
| + | |||
<iframe src="http://google.com" name="google" style="height:100px"></iframe> | <iframe src="http://google.com" name="google" style="height:100px"></iframe> | ||
| + | |||
| + | |||
| + | |||
<script> | <script> | ||
document.getElementsByName('google')[0].onload = function() { | document.getElementsByName('google')[0].onload = function() { | ||
try { | try { | ||
| − | alert(frames[0].location) | + | alert(frames[0].location.href) |
} catch(e) { | } catch(e) { | ||
alert("Error: "+e) | alert("Error: "+e) | ||
| Línia 11: | Línia 15: | ||
</script> | </script> | ||
| − | </ | + | </source> |
Revisió de 17:57, 27 set 2017
<iframe src="http://google.com" name="google" style="height:100px"></iframe>
<script>
document.getElementsByName('google')[0].onload = function() {
try {
alert(frames[0].location.href)
} catch(e) {
alert("Error: "+e)
}
}
</script>