-
Notifications
You must be signed in to change notification settings - Fork 14
Ajax
Ajax is working great on every platforms.
In most of the case, just use your regular $.ajax() stuff, or the other method used in your favourite javascript framework and it will work as if it was on your browser.
but, there is a "but"...
On Android, there is a domain white list to avoid webviews to do crossdomain ajax without your permission. more precisely without the app permission.
In Cobalt we used a wildcard and all the scripts of your Cobalt webviews can cross-domain as they want. We will provide a way to customise this one day, I promise.
BlackBerry10 webviews don't allow cross domain AJAX. At All. And there is no whitelist system at the time we write this. that's a shame.
But on the native side, using javascript, we can do crossdomain ajax without problem. Where is the logic here? I don't know.
So we built a bridge and used Cobalt to bind "$.ajax" jQuery style ajax calls to a native one and fetch the result, and send back the result to the javascript.
This should be totally transparent for the user but we may have forgot special cases if you do some weird ajax stuff in your app (adding headers, cheating with HTTP, etc).
Ajax success and error are handled, POST, GET, json results. most of the common cases.
$.ajax timeout option for example has not been tested.
And finally, if you don't use $.ajax but another method for XMLHTTPRequest, you will definitively have troubles on BlackBerry10. Drop us a line if you are stuck with this.
Cobalt is an Open-Source Hybrid Mobile Framework. Read more about it on the home page or in the documentation
- Introduction to Cobalt navigation
- The cobalt.json file
- native navigation bars
- Handling the Android back button
- Introduction to Cobalt messages
- Publish/Subscribe on the Web side
- Publish/Subscribe on Android
- Publish/Subscribe on iOS
- Web Lifecycle messages
- Pull-To-Refresh and Infinite Scroll
- Custom alerts and Toasts
- LocalStorage
- OpenExternalUrl
- PlatformInfos
- Ajax
- Removing the top bar
- Adding Cobalt to an existing project
- Customizing your hybrid views
- Handle multiple Cobalt webviews on the same screen (TODO)