Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm developing a mobile app which runs a simple HTTP server and a WebView. The WebView displays an external website which should access the server via javascript (GET). Unfortunately this doesn't work and I assume it's due to the same origin policy but the console doesn't show any errors. I had a similar error before which required me to define "Access-Control-Allow-Origin: *" on the server side. This error already took a while to find because there were no error messages (Firebug "Net" tab showed a completed GET request with empty "response" data). Now I assume a same origin policy violation in the external script, but it's hard to tell because of the missing error messages. The only "hint" I see is in Firebug "Net" tab, showing a connection which "never completes". I checked the packages sent to localhost but there wasn't even a connection attempt => thus I assume the browser is holding it back.

How do I display Javascript "same origin policy" violation errors in Firefox (ext: Firebug, Webdeveloper)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
167 views
Welcome To Ask or Share your Answers For Others

1 Answer

Firefox(3.6.20 and Chrome) throws an error on XMLHttpRequest cross domain violations. These errors can being silenced by try{...} catch(ignore){} blocks. If you know the actual path of the request you can check in the Firebug's "Net" tab, all the requests(even those denied by "same origin policy") show in the "All" section, and in the "XHR" section those denied by "same origin policy" don't.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...