简体   繁体   中英

loading other webpage in my site with jquery is not working

<script>
$(document).ready(function(){
$("#My-page").load("http://www.google.com");
});
</script>
<div id="My-page" style="width:900px; height:900px; position: absolute;overflow-x:hidden !important;-webkit-overflow-scrolling:touch !important;">
</div>

actually i have tried with iframe to load embed code of my site in another webpage it is working fine in android mobiles and windows pc , when come to ios it is not working , someone suggested me to load embed code through js without using iframe , when iam loading external webpage through js it is not working , can anyone help how to solve this problem

It's a CORS problem, security limit

You can't access to any url under javascript in browser, you can access to url from your current domain or to url that allow CORS

http://www.w3.org/TR/cors/

You can do this, but not with client side code. You need to use a server language like php. It is possible to overcome the CORS issue, you may need to use a proxy too. If you post your server code, can look at that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM