简体   繁体   中英

Load and manipulate on my page elements from different domain

I am trying to load in a div from my page the content of a different domain page. I've tried to use <object> or <iframe> , the content is loaded but I am not allowed to manipulate it with jQuery. Also, I had the same error:

XMLHttpRequest cannot load 'URL'. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost:15297 ' is therefore not allowed access

, when I tried

$.get("URL", function (data) {
    $("#divID").append(data);
}

Is there any work around to load and manipulate content from different domain page with jQuery?

You need to organise connection between child and parent page using postMessage.

Seems like this lib could help you https://github.com/travist/seamless.js

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