Reputation: 83
i am trying to load www.google.com
in an iframe. But i am not getting required results.
Please help me to figure out the error.
here is the jsfiddle.
Upvotes: 2
Views: 166
Reputation: 11
(My first stackoverflow answer, so bear with me.)
As I read in this other stackoverflow post: How do I load a URL specified in a textbox in an iframe?
the problem is not in the code, but in the fact that "some sites refuse to load the page inside an iframe (example: http://google.com)"
I have a similar tool done here: http://www.carljohansson.net/tools/a-simple-responsive-viewer.php where I load the url from an input[type=text] to be shown inside an iframe to test the responsiveness of a website. While testing your issue I saw that google wouldn't load either on my page.
Cheers!
Upvotes: 1
Reputation: 2261
Mostly protected and famous sites have already protected it from grabbing their page inside an iframe. Some others are not, e.g. w3schools.com. you'll see the page appears inside the iframe. That's why it is impossible to do that on protected site. Some say that this is against privacy and policy.
This is frequently done by PTC site.
Please check here for further information: jQuery/JavaScript: accessing contents of an iframe
Upvotes: 1