Closed bradniksa closed 9 years ago
So the timeout is definitely being caused by the (cancelled)
request to proxy.html
, however I'm not sure why it's being cancelled. Maybe the iframe is being removed?
If I create a small page with just:
<script src="//cdn.rawgit.com/jpillora/xdomain/0.6.17/dist/xdomain.min.js" slave="http://leapcommunication.com/proxy.html"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script>
$.get("http://leapcommunication.com/");
</script>
In the logs, we see:
xdomain.min.js:3 xdomain (http://leapcommunication.com): adding master: http://go.americasmart.com
xdomain.min.js:3 xdomain (http://leapcommunication.com): new socket: xdomain-a3881674
xdomain.min.js:3 xdomain (http://leapcommunication.com): blocked request from: 'http://fiddle.jshell.net'
xdomain.min.js:3 xdomain (http://leapcommunication.com): receive socket: xdomain-a3881674: 'XD_CHECK'
xdomain.min.js:3 xdomain (http://leapcommunication.com): send socket: xdomain-a3881674: ready
xdomain.min.js:3 xdomain (http://leapcommunication.com): ready socket: xdomain-a3881674 (emit #0 pending)
xdomain.min.js:3 xdomain (http://leapcommunication.com): receive socket: xdomain-a3881674: 'ready'
xdomain.min.js:3 xdomain (http://leapcommunication.com): receive socket: xdomain-a3881674: 'request'
xdomain.min.js:3 xdomain (http://leapcommunication.com): receive socket: xdomain-a3881674: 'XD_CHECK'
It would have worked if the domain wasn't blocked (blocked request from: 'http://fiddle.jshell.net'
)
Please recreate this issue on a simpler page and I'll take another look because at the moment it's hard to figure out what's happening
Its weird, because I have another page at http://go.americasmart.com/inspire2015 where xdomain is working fine, only difference is the the ajax call on this page is initiated by a user interaction where the other page with the error, xdomain is called on page load, ill play around a little more and try to narrow down the issue, thanks for your response.
ok, here is a simple page http://go.americasmart.com/xdomain Turns out if set the ajax call to a click event vs on page load it works fine, any ideas why we are error on that file only during page load?
HI,
if hit error, xdomain (): Timeout waiting on iframe socket.
How to do error handling on this? for example: when hit this error, direct user to error page.
ping @jpillora
@bradniksa it wouldn't be about when it's used. The XDomain demo does an Ajax on load and it seems to work. Did you figure it out?
@EvenOng you can handle it with the on("timeout",...) API see docs, It will only happen if your proxy.html doesn't load, so it should never happen once your page is setup correctly
Hi @jpillora ,
This correct? Now it always log out me no matter timeout or not.
xdomain.on('timeout', errorHandling());
function errorHandling(){ window.location = "http://a.test.com/logout.php" ; }
try dropping the (), so just errorHandling, the () makes it call the function, you want to pass the function itself
On Mon, Jan 19, 2015 at 7:43 PM, EvenOng notifications@github.com wrote:
Hi @jpillora https://github.com/jpillora ,
if this correct? Now it always log out me no matter timeout or not.
xdomain.on('timeout', errorHandling());
function errorHandling(){ window.location = "http://a.test.com/logout.php" ; }
— Reply to this email directly or view it on GitHub https://github.com/jpillora/xdomain/issues/126#issuecomment-70460992.
@jpillora I just hit this.
It will only happen if your proxy.html doesn't load
This isn't true. The html page loads fine, but still throws this error. I can't for the life of me figure out why. Calling everything slave/master has confused me too, as well as naming the domains abc/xyz. :/
I have a simple $.ajax call
I am getting this error - xdomain (http://go.americasmart.com): Timeout waiting on iframe socket this is a current version of chrome
Site XHR is on http://go.americasmart.com/iconhonors/entry-list
Proxy.html @ http://leapcommunication.com/proxy.html
Here is a network error on the proxy file
Here is the Debug code xdomain (http://go.americasmart.com): adding slave: http://leapcommunication.com xdomain.min.js:3 xdomain (http://go.americasmart.com): proxying request to slave: 'http://leapcommunication.com' xdomain.min.js:3 xdomain (http://go.americasmart.com): creating iframe xdomain-f7ad0302 xdomain.min.js:3 xdomain (http://go.americasmart.com): new socket: xdomain-c833a639 xdomain.min.js:3 xdomain (http://go.americasmart.com): proxying request to slave: 'http://leapcommunication.com' xdomain.min.js:3 xdomain (http://go.americasmart.com): new socket: xdomain-3c0d3f13 xdomain.min.js:3 xdomain (http://go.americasmart.com): proxying request to slave: 'http://leapcommunication.com' xdomain.min.js:3 xdomain (http://go.americasmart.com): new socket: xdomain-92aaec8f xdomain.min.js:3 xdomain (http://go.americasmart.com): proxying request to slave: 'http://leapcommunication.com' xdomain.min.js:3 xdomain (http://go.americasmart.com): new socket: xdomain-91919a3b xdomain.min.js:3 xdomain (http://leapcommunication.com): adding master: http://go.americasmart.com 4xdomain.min.js:3 xdomain (http://go.americasmart.com): Timeout waiting on iframe socket
Any help would be much appreciated