3

1

I'm trying to build bugzscout into my JavaScript app so it can report errors when it encounters them. I'm currently opening a hidden iframe, programatically filling in the fields and submitting it. This allows the bug to be submitted, but I can't get the response as most browsers block JavaScript from reading content from a different Origin.

The W3C way for doing this is Cross-Origin Resource Sharing. This would require a change to the headers that bugzscout returns to the browser. It would also only work in a subset of browsers.

Does anyone have a way I can both post and read the response from bugzscout from a JavaScript app?

flag

2 Answers

2

Your best bet is probably to proxy your BugzScout submission via a server-side script (assuming your web server can make out-bound web requests, that is).

This way, your client-side app submits a request to your own server, your server-side code then sends the BugzScout request to FogBugz, receive its response, and sends that down to your client-side JavaScript for display (or whatever).

link|flag
Yea, this is a good standard solution for most people. Unfortunately, in my case, there is no active server side code, it is all just static files. – alumb Dec 15 2010 at 18:36
0

I'm not real familiar with cross-site javascript limitations, but would it be possible to construct an img tag such that the "image" being requested has all of the fields set as query string parameters?

This would, I think, get around the cross-site issue, because images can come from different sites. Also, it gets around the limitations on the erroring server you mentioned (not having any server-side code).

link|flag
The form in an iframe solution works much better than this. The problem is not submitting the data, it is reading the response. – alumb Dec 16 2010 at 0:55

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.