Skip to main content

Bug Tracker

Side navigation

#10660 closed bug (wontfix)

Opened November 04, 2011 02:13AM UTC

Closed March 07, 2012 04:19PM UTC

Last modified March 18, 2014 01:51PM UTC

no transport error on Windows Phone 7

Reported by: mike@marcucio.com Owned by: mike@marcucio.com
Priority: low Milestone: None
Component: ajax Version: 1.6.4
Keywords: Cc: jaubourg
Blocked by: Blocking:
Description

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

Attachments (0)
Change History (10)

Changed November 04, 2011 03:01AM UTC by dmethvin comment:1

owner: → mike@marcucio.com
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.

Changed November 04, 2011 02:04PM UTC by mike@marcucio.com comment:2

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.

Changed November 05, 2011 09:27PM UTC by timmywil comment:3

cc: → jaubourg
component: unfiledajax
keywords: → needsreview
priority: undecidedlow
status: newopen

Changed November 30, 2011 11:38PM UTC by purplecabbage@gmail.com comment:4

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

Changed March 07, 2012 04:19PM UTC by jaubourg comment:5

_comment0: ``` \ $.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.1331137194875135
keywords: needsreview
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.

Changed April 18, 2013 09:58PM UTC by anonymous comment:6

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

Changed April 19, 2013 04:00PM UTC by Mike comment:7

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

Changed April 19, 2013 04:10PM UTC by anonymous comment:8

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:'

Changed May 08, 2013 11:38AM UTC by MJHeijster comment:9

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.

Changed March 18, 2014 01:51PM UTC by gabriel.schulhof@intel.com comment:10

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.