jquery.rdbhost.cors.js
The jquery.rdbhost.cors.js library works in modern browsers only, those that support the CORS extension to HTTP. If you are building an html5'ish site, you are already constrained to modern browsers anyway, and this library may serve you very well.
The API, the set of functions and methods, is the same as our other javascript library, jquery.rdbhost.js. You can switch between them by changing the script tag; the remaining code will generally still be valid. Obviously there are differences, otherwise why have two library? Read on for more detail.
Since you, as a web developer, are very likely using the latest browser version, you can start using this library as a dropin. Setup an account on the www.rdbhost.com website, if you haven't already, add your development host url to the remote hosts config field on the website, add a script tag to your html page including the library, and you are in business.
If the project develops to the point where compatibility with older browsers matters, or if you eventually need features like binary uploading that ajax does not support, you then easily swap out the jquery.rdbhost.cors.js module for the jquery.rdbhost.js module, and your code will be otherwise unchanged.
Changes to the website to support this include adding the CORS compliant headers to those page requests that present 'Origin' headers, and adding a field to the account records that tracks which domains are permitted to access each account. There is a new status line on the profile page to report what domains are registered, and a new form page, 'remote_hosts', to permit changing that domain list.
Differences
The regular library is both more capable and more hassle to setup.
- Requires your domain (possibly 'local.host') to have a subdomain that points at our server.
- Allows binary data uploads to database using file fields, as well as raw binary downloads.
- Works in nearly all browsers in common use, including Internet Explorer 6.
The cors library is easier to use, but has significant limits
- Domain configuration is NOT necessary
- No binary upload, though binary downloads of database contents is still possible.
- Requires a newer browser, Firefox 3.5+, Chrome 5+, Safari 4+, maybe Opera
Links:
- Information about DNS subdomain configuration
- The library, in Git, on github.com
- The w3c working draft on CORS
- The Rdbhost Javascript howto page.
No comments:
Post a Comment