Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.0
-
None
-
Development Environment: Visual Studio 2012 (with Update 3), Windows 8 x64,
Target Environment: Windows Phone 8.0
Other libraries - jquery, requirejs
Description
In the WP8 application we are developing, when the following code is being executed -
$.get("/www/folder/to/devConfig.txt").done( function(content) {
settings = JSON.parse(content)
} );
I get the following exception:
{System.InvalidOperationException: This operation is not supported for a relative URI.
at System.Uri.get_AbsolutePath()
at WPCordovaClassLib.CordovaLib.XHRHelper.HandleCommand(String commandStr)
at WPCordovaClassLib.CordovaView.CordovaBrowser_Sc...
I tried various combination such as:
- "file:///www/folder/to/devConfig.txt" and "file://localhost/folder/to/devConfig.txt", which translated to "/www/folder/to/devConfig.txt", in the relative path.
In these cases I received a 404 error.
Reading through the documentation, it seems that the first "/" needs to be removed for the relative path to work, instead of "/www/folder/to/devConfig.txt" should be "www/folder/to/devconfig.txt".
Sending "www/folder/to/devconfig.txt", causes the first exception.
As a fix, I have modified the XHRHelper code to check for isAbsoluteUri condition and remove the first "/" if it is a relative path. That seems to work. But it is not a future proof solution.
Please advise.