Chrome에는 자체 Greasemonkey가 있습니다. 어쨌든 많은 제한이 있습니다. 그 중 하나는 xmlhttprequest가 Cross-Origin을 지원하지 않는다는 것입니다. 그래서 그것을 작동시키는 어떤 방법이 있습니까?Chrome의 사용자 스크립트, Cross-Origin 통신
감사
Chrome에는 자체 Greasemonkey가 있습니다. 어쨌든 많은 제한이 있습니다. 그 중 하나는 xmlhttprequest가 Cross-Origin을 지원하지 않는다는 것입니다. 그래서 그것을 작동시키는 어떤 방법이 있습니까?Chrome의 사용자 스크립트, Cross-Origin 통신
감사
스크립트가 오페라에게 친숙하도록하려면, 여전히 GM_xmlhttpRequest를 사용할 수 없습니다. 그러나 YQL과 jQuery를 사용하여,이처럼 수행 할 수 있습니다있는 maxage 매개 변수에 대한 정보를
var getCrossDomain = function (url, callback, maxage) {
if (typeof (url) !== 'undefined') {
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + url + '"') + '&diagnostics=false&format=xml&callback=?&_maxage=';
if (typeof (maxage) === 'undefined') {
yql += '10000'; // Value is in ms
}
$.getJSON(yql, function (data) {
if (typeof (callbackX) === 'function') {
callback(data.results[0]);
}
}).fail(function (jqXHR, textStatus, errorThrown) {
// Some code here to handle a failed request
});
}
};
감사합니다. 좋은 소식입니다. – cn1h