I’d like to be able to load an external site into a div – for example googles homepage.
Ive tried:
$('#myDiv').load("http://www.google.com");
with no such luck.
Any help would be much appreciated. Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What you want to do is dangerous and should be avoided. You’ve given an example of cross-domain requests and most browsers block you from doing this. You’re violating the same-origin policy.
Use an
<iframe src="http://www.google.com"></iframe>if you really have to.There’s also a supposed solution with jQuery and YQL, but I’ll let you sniff that one out.