Hi, first post - I use to have account here but it was registered with old e-mail address and I can't even remember the username, been that long.

When this goes production, a reverse proxy should eliminate the need for CORS but until then, my event server is different port so CORS is needed. I know CORS isn't supported with SSE with every browser, but that's OK, XHR polling fallback (like already have to do with IE).

Anyway, here's the JS I'm having issue with:

Code:
/* useCORS - JS global defaults to false
 * useSSE  - JS global defaults to false
 * feed    - URL of the SSE server
 */
function testFeed() {
	//this function tests whether or not we can reach the feed by SSE or if we will need to fall back to XHR
	//can't just use modernizr because SSE support itself may not be enough if CORS is needed
	var host,test,evtSrc
	//does not account for non standard port for main location. web page
	host=location.protocol + '//' + trim(location.hostname).toLowerCase();
	feed=feed.toLowerCase();
	if (host != feed) {
		useCORS=true;
	}
	if (window.EventSource) {
		if (useCORS) {
			evtSrc = new EventSource(feed + '/test');
			evtSrc.onopen = function() {
				evtSrc.close();
				useSSE=true;
			}
			evtSrc.onerror = function() {
				evtSrc.close();
				alert('error');
			}
		} else {
			useSSE=true;
		}
	}
}
The CORS header is being sent.
That function is run on pageload.

In IE works as expected, useCORS is true and useSSE is false after function runs.
In FireFox works as expected, useCORS is true and the evtSrc.onopen event fires setting useSSE to true.
In Opera, which I thought supported SSE with CORS, the evtSrc.onerror event fires, useCORS is true and useSSE is false. I'll look at why Opera fires onerror later.

My problem is with the webkit browsers, Chrome and Safari to be specific.
Neither .onopen nor .onerror fires and the JavaScript just hangs. Nothing JavaScript works.

I do most of my JS debugging in FireFox but I installed a couple add-ons to chrome that are suppose to show me any JS errors and it isn't.
If I comment out the attempt to connect to the EventSource - all other JavaScript works perfectly, but if I run the test to see if it can connect, all JS hangs, neither event fires, and I can't figure out why.

Help?