English 中文(简体)
Chrome 延期 跨领域请求
原标题:Chrome extension Cross Domain Request

我知道,这里已经谈了很多时间,我读到了这些线索中的大多数,但我看不到我的文字。

问题在于,我正试图利用比喻的皮来缩短古戈格尔幼苗的延伸。 在我这样做之前,我保存了当地储存中的用户标识和缩影。

这样做的守则是:

$.ajax({
        url:"http://api.bit.ly/v3/validate",
        dataType: jsonp ,
        data:{
            login: login,
            apiKey: apiKey,
            x_login :"test",
            x_apiKey :"test"
        },
        success:function (jo, textStatus, jqXHR) {
            if (jo.status_code == 200) {
                setItem( dg_BitlyApiKey , apiKey);
                setItem( dg_BitlyLogin , login);
                alert( Saved );
            } else {
                alert( Incorrect login and/or apiKey! )
            }
        }
    });

我确实有我的许可:permissions”:“tabs”、“notifications”、“http://*/*”、“https://*/*”,但我仍然保留:

Refused to load script from  http://api.bit.ly/v3/validate?callback=jQuery17204477599645033479_1334062200771&login=&apiKey=&x_login=test&x_apiKey=test&_=1334062201506  because of Content-Security-Policy.

文字本身在展期之外发挥作用,因此我假定问题在文字内,但得到许可。

我在这里做了什么错误呢?

最佳回答

The problem is that you aren t really doing a XHR request, you re doing a JSONP request on an insecure HTTP resource. See the question How to load an external JavaScript inside an extension popup and the related Chromium bug report.

Yeah,我们不再允许在延期中提供不可靠的文字。 如果你把手稿装上吉大港山区,一个活跃的网络攻击者就可以向您的延伸注入文字,这是安全上的脆弱性。

JSONP通过在你的网页上积极添加新的文字标签,然后执行内容。 就你而言,文字资源与吉大港山区(而不是高港区)相隔。 如果您的延期使用延期清单第2版,其背景页不能打上非吉大港定居地定居地。

<>Solution: 如果你使用比照的比照灯,我相信这将解决你的问题。 下午2:00 Ajax 电话https://api-sl.bitly.com/v3/validate (取代您目前对<代码>的价值:http://api.bit.ly/v3/validate)

问题回答

你们需要包罗你对跨领域工作请求的供述/延期。 东道申请无法进行跨领域申请。 见:

https://stackoverflow.com/questions/9421933/ cross-origin-xmlhttprequest-in-chrome-extensions/9422216#9416>Cross-Origin XMLHttpRequest in chrome分机

在 Chrome延伸中提出交叉要求,需要避免内容文本中的交叉使用法。

Full answer you can found in https://stackoverflow.com/a/56929473/3680164

Or in the documentation https://www.chromium.org/Home/chromium-security/extension-content-script-fetches





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签