- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm install Intel App Preview on my Windows 8.1.
When I run an ajax call on external url in "test mode" does not work, however if I "build" the same application, install and run the same ajax calls return successfully.
Why I can't execute external ajax call in Intell App Preview?
Thanks.
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are experiencing an issue associated to Cross Origin Resource Sharing. I recommend that you include a reference to the xhr.js script in the head tag of your index.html file. This should resolve this issue.
<script src="xhr.js"></script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you!
I tried to follow your suggest but still not working.
I use Cordova + Angular + Onsenui , when compiling the app for Windows 8.1 and run it works perfectly , it also works on the Preview App for iOS and Android , the only problem persists on App Preview for Windows 8.1
Amrita C. (Intel) wrote:
You are experiencing an issue associated to Cross Origin Resource Sharing. I recommend that you include a reference to the xhr.js script in the head tag of your index.html file. This should resolve this issue.
<script src="xhr.js"></script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This sounds like a bug with the Windows 8 App Preview tool. I'll make a note for engineering.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which plugins are you using in your app?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, intel XDK v2248
Camera v0.3.4
Connection v0.2.14
Device v0.2.13
File v1.3.2
File Transfer v0.4.8
In app Browser 0.5.4
SplashScreen 0.3.5
------
This my HTML:
<!DOCTYPE html> <html lang="it" ng-app="uibm" ng-controller="app" ng-csp> <head> <meta charset="utf-8" /> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="mobile-web-app-capable" content="yes" /> <script src="lib/angular/angular.js"></script> <script src="lib/angular/angular-sanitize.js"></script> <script src="lib/angular/angular-resource.js"></script> <script src="lib/angular/angular-deckgrid.js"></script> <script src="lib/angular/angular-lazy-img.js"></script> <script src="lib/angular/ng-cordova.js"></script> <script src="lib/onsen/js/onsenui.js"></script> <script src="lib/jquery-2.1.4.min.js"></script> <script src="scripts/app.js"></script> <script src="scripts/controllers.js"></script> <script src="lib/winstore-jscompat.js"></script> <script src="xhr.js"></script> <script src="cordova.js"></script> <!-- CSS dependencies --> <link rel="stylesheet" href="lib/onsen/css/onsenui.css" /> <link rel="stylesheet" href="css/onsen-css-components.css" /> <link rel="stylesheet" href="lib/angular/angular-csp.css" /> <link rel="stylesheet" href="css/style.css" /> <title>Uibm</title> </head> <body> <ons-sliding-menu menu-page="template/menu.html" side="left" var="menu" type="reveal" max-slide-distance="260px" swipeable="true"></ons-sliding-menu> </body> </html>
---------------
Example of Ajax query:
......
$http.post('http://geo.shaggyowl.com/app/api100/stato_lac/', {})
.success(function (response) {
if (response.status != 2) {
ons.notification.alert({ message: response.messaggio });
}
else {
$scope.statusLac = response.parametri.stato_lac;
}
})
.error(function (data, status, headers, config) {
ons.notification.alert({ message: 'Error' });
});
.........
WEINRE work fine, the $http request start but interrupt without responce after a few seconds.
Thank you!
Paul Fischer (Intel) wrote:
Which plugins are you using in your app?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
xhr.js has no meaning in this context, it is only meaningful in a legacy build situation (it does nothing in a Cordova build and the current version of App Preview for Windows is also based on Cordova). You can remove that script reference (there is no harm to include it, but it is not doing anything useful).
Are you waiting for the Cordova device ready event before you do anything? This is required even in App Preview. See the blank HTML5+Cordova template for a good example of how to do that. You can reuse that code, especially the init-dev.js file, which then generates an event named app.Ready that you can then trigger your app.
![](/skins/images/D3C0B914909A6564BBB97F4AD1ED1973/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page