On my localhost, I am using the following JavaScript to create an iframe with src, and add it to the document:
$(\'#preview\').html
Yes the code is forbidden because of same origin policy. Read here
Suppose you own the domain http://www.example.com then you can probably have following results, when you call pages through iframes:
Compared URL Outcome Reason
---------------------------------------------------------------------------------------------
http://www.example.com/dir/page.html Success Same protocol and host
http://www.example.com/dir2/other.html Success Same protocol and host
http://www.example.com:81/dir2/other.html Failure Same protocol and host but different port
https://www.example.com/dir2/other.html Failure Different protocol
http://en.example.com/dir2/other.html Failure Different host
http://example.com/dir2/other.html Failure Different host (exact match required)
http://v2.www.example.com/dir2/other.html Failure Different host (exact match required)
Now, you are calling google.com, which is a cross domain issue upon you. To get around such a problem, JSONP can help you out. It uses open script policy for , to retrieve JSON from cross domains.