Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
174
rated 0 times [  179] [ 5]  / answers: 1 / hits: 68121  / 11 Years ago, thu, june 6, 2013, 12:00:00

My iFrame looks like this:



<iframe id=iframe name=iframe1 frameborder=0 src=></iframe>


And my script looks like this:



<script type=text/javascript>
$(document).ready(function() {
$('#iframe').attr('src',http://google.com);
})
</script>


I've also tried putting quotes around the url:



<script type=text/javascript>
$(document).ready(function() {
$('#iframe').attr('src','http://google.com');
})
</script>


But neither is working.



What am I missing?


More From » jquery

 Answers
56

If you look at the browser's error console, you'll see the real problem:




Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.




Google doesn't let you do that.


[#77774] Wednesday, June 5, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mckenna

Total Points: 445
Total Questions: 109
Total Answers: 109

Location: Virgin Islands (U.S.)
Member since Sun, May 16, 2021
3 Years ago
;