V
V
Vahe2015-12-02 21:35:36
JavaScript
Vahe, 2015-12-02 21:35:36

$.getScript returns an error?

var content = '';
document.write = function(s) {
    content += s;
};

$.getScript('http://www.reddit.com/domain/skattertech.com/new/.embed?limit=4&t=all&sort=new&style=off', function(){
    $('body').append(content);
});

Refused to load the script ' www.reddit.com/domain/skattertech.com/new/.embed?l... ' because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome -extension-resource:".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2015-12-02
@vahe_2000

same-origin-policy is a cruel thing.
https://developer.chrome.com/extensions/contentSec...
If you need to inject exactly on the page, you can try:

var s = document.createElement('script');
s.src = url
s.async = true
document.getElementsByTagName('head')[0].appendChild(s)

It seemed to work before.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question