jsonp - How do browsers assess the origin domain for XMLHttpRequest? -


i thought origin domain xmlhttprequest domain loaded javascript using it.

for instance, thought if on page http://mydomain1.com/ have:

<script src="http://mydomain2.com/script.js" /> 

script.js can interact mydomain2.com via xhr. was, thought, 1 of nice things jsonp.

i seeing bit of evidence in testing though js loads mydomain2.com, xhr's origin still mydomain1.com. have been way off base time?

it domain of page (possibly in frame) executes javascript.

if domain javascript loaded, happen people using jquery.ajax after loading jquery cdn (such http://code.jquery.com/jquery-1.6.2.js)? ;-)

jsonp doesn't allow acting as domain, rather allows injecting from domain. source uri of script element not restricted same domain origin restriction xhr: in manner jsonp can used freely send data (in uri) , execute returned javascript (not json) directly in context of current page.

including script tags remote sites allows remote sites inject content website. if remote sites have vulnerabilities allow javascript injection, original site can affected.

happy coding.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -