Same origin policy in external js file

if the website http://www.mysite.comhas an external js file added as

<script src="http://www.yoursite.com/new.js"></script> 

in the http://www.yoursite.com/new.jsjs file , there is an ajax call to the script inhttp://www.yoursite.com/new.js

in this case there will be a security problem of a policy of the same origin, since it calls a script on a site from another site?

+3
source share
2 answers

There will be a problem. new.jsperformed in the field mysite.com, not yoursite.com.

EDIT: : mysite.com , script . script : , , mysite.

, mysite.com - . .

. jsonp. , yoursite.com , , .

+4

JSONP - , : http://en.wikipedia.org/wiki/JSON

5 000 , JSONP , . , JSON . "script", , .

jQuery, . : http://api.jquery.com/jQuery.getJSON/

0

Source: https://habr.com/ru/post/1763428/


All Articles