Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#10660 closed bug (wontfix)

no transport error on Windows Phone 7

Reported by: mike@… Owned by: mike@…
Priority: low Milestone: None
Component: ajax Version: 1.6.4
Keywords: Cc: jaubourg
Blocked by: Blocking:


an ajax request throws a 'no transport' error using PhoneGap and Windows Phone 7. To fix this we need to do a:

$.support.cors = true;

before the request. This might be related to the fact that in this situation:

parent.location.protocol == 'x-wmapp1:'

not file: or local: like on other devices

Change History (10)

comment:1 Changed 5 years ago by dmethvin

Owner: set to mike@…
Status: newpending

Since we just shipped 1.7 today we aren't going to be able to do any internal fix for a while, so the cors solution is fine. And I'm not sure that we should. Is the "x-wmapp1" protocol some standard name? If so it sure seems to be randomly chosen.

comment:2 Changed 5 years ago by mike@…

Status: pendingnew

I do agree that it is not a very high priority bug since there is a workaround the user can do, and I agree that Microsoft shouldn't be just making up their own protocol where local: or file: would work fine.

But I do think it should be eventually fixed since it would seem to be a very low risk fix and we gain consistently across all platforms. I have already seen a few posts of people running into this issue.

comment:3 Changed 5 years ago by timmywil

Cc: jaubourg added
Component: unfiledajax
Keywords: needsreview added
Priority: undecidedlow
Status: newopen

comment:4 Changed 5 years ago by purplecabbage@…

I am dealing with this directly in PhoneGap code for WP7 Mango. The issue is a security access violation when using XHR to local files. The WP7 Silverlight WebBrowser component does not have a domain when running locally, so ALL local XHR requests fail. Not just a jQuery issue.

  • Jesse

comment:5 Changed 5 years ago by jaubourg

Keywords: needsreview removed
Resolution: wontfix
Status: openclosed

` $.support.cors = true;

` is the way to go for now. Mobile browsers move too fast and too ectically for us to handle every single case.

Version 0, edited 5 years ago by jaubourg (next)

comment:6 Changed 4 years ago by anonymous

So do you think one programmer can use this "bug" for gain informations about other sites?

comment:7 Changed 4 years ago by Mike

I disagree with closing this issue, we should have confidence that jQuery will work across all devices/browsers. This bug is very easily fixed in the jQuery code, it is a very low risk fix, and we gain consistently across all platforms.

This is not the old windows phone OS, this is the new windows 8 OS

comment:8 Changed 4 years ago by anonymous

just one more bit of info, Windows Phone and Windows 8 desktop use 2 different protocols:

parent.location.protocol == 'x-wmapp1:' and parent.location.protocol == 'ms-appx:'

comment:9 Changed 4 years ago by MJHeijster

With Windows Phone 8 the thrown error is NetworkError instead of No Transport.

My test code for both WP7 and WP8:

 $.ajax("http://localhost:8081/api.html", {

            async: false,
            contentType: "text/xml",
            data: body,
            type: "POST",
            success: function (data, textStatus, jqXHR) {
                console.log("request successful, body: " + data);
               //Code that should happen
            error: function (jqXHR, textStatus, errorThrown) {
                console.log(textStatus + ": " + errorThrown);

Logged in Console: WP7: Log:"error: NetworkError" WP8: Log:"error: NetworkError"

If I put $.support.cors = true; in front of it, it works.

comment:10 Changed 3 years ago by gabriel.schulhof@…

Cordova adds a XHRHelper.cs component that makes things work in WP7 and WP8, as long as you don't use absolute URLs of the form x-wmapp0://www/filename.html. If you just request www/filename.html it will work just fine.

I have proposed a fix that will allow WP7 and WP8 to handle absolute URLs at https://github.com/apache/cordova-wp8/pull/30/. This means that, if my PR is accepted, then WP8 with Cordova will be completely fine, while WP7 will still require the $.support.cors workaround.

The only remaining argument for this workaround to be included in core, IMO, is that whenever it works in plain JS (i.e. whenever Cordova is around to provide handling of Ajax to this weird URL scheme), it should also work in jQuery, but currently it does not.

Note: See TracTickets for help on using tickets.