Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

alternative to cross-domain javascripting?

currently i am relying on a proxy script to handle this problem of Single Origin Policy. it is slow, and creates overhead. Not to mention, javascript is not rendered.

is there a working alternative out there?

like image 762
dooli Avatar asked Dec 21 '25 14:12

dooli


2 Answers

If you can provide a callback name as a parameter to the service providing the JavaScript code in question, then you can append a script tag to your document, with a src attribute pointing to the service call. Otherwise, you're out of luck.

like image 118
Jonathan Feinberg Avatar answered Dec 24 '25 02:12

Jonathan Feinberg


Use an iframe and try window.postMessage(message, origin) (it would be parent.postMessage from the iframe and iframeElement.contentWindow.postMessage from the top page) for all of the latest major browsers (Firefox, IE, Safari, Chrome, etc.) and changing/polling window.name for old browsers.

like image 45
Eli Grey Avatar answered Dec 24 '25 02:12

Eli Grey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!