Using nosql for a browser extension? - javascript

I'd like to have a backend for my chrome/firefox extension app which makes queries to a local (preferably nosql) database. Is there any way to do this? Perhaps a query language for accessing chrome.storage?

read about html5 storage in particular indexedDb and web sql. those are the only possible ways to query storage (ok well the html5 filesystem api is also a way that could be considered indexed by using folders).
All three work well in chrome. Make sure to use them from the correct location (background script). Havent tried with other browsers, check their html5 compatibility.
Even if you use something specific of Chrome, both Firefox and Edge recently promissed supporting chrome extensions by just repackaging them for their store.

Related

Alternative option for cookie

I have been working on front end framework call "BackboneJs", I have used the cookie to store data in browser.
But in some case i need to store more data which does not supported by cookie.
Is anyone know the best option for storing considerable large data which cookie does not support.
Please suggest your ideas.
And yes it must be cross browser supported
You can refer to http://lucb1e.com/rp/cookielesscookies/ ,
This tracking method works without needing to use:
Cookies
Javascript
LocalStorage/SessionStorage/GlobalStorage
Flash, Java or other plugins
Your IP address or user agent string
Use HTML5 local storage.
Reference : http://www.w3schools.com/html/html5_webstorage.asp
You can use cross-browser compatible library jStorage for this.
jStorage is a cross-browser key-value store database to store data
locally in the browser - jStorage supports all major browsers, both in
desktop (yes - even Internet Explorer 6) and in mobile.
Additionally jStorage is library agnostic, it works well with any
other JavaScript library on the same webpage, be it jQuery, Prototype,
MooTools or something else. Though you still need to have either a
third party library (Prototype, MooTools) or JSON2 on the page to
support older IE versions.

How to check the last available version of Chrome and Firefox using C# or JavaScript?

One of the requirements of one of my clients is to show a message to a user that's using an older version of Firefox, Chrome, IE or Safari. For the last two it's easy (IE 9+ and Safari 5+). But for Firefox and Chrome, the requirement is that the site supports the current and the previous version of each browser.
To get the clients browser and version is quite simple, but I need to know what is the last version of each browser. Is there any way of doing that?
Well, technically, all you need is a place that keeps track of what the latest version of each browser (Ideally with a web service).
A quick Googling I was able to find: http://www.webdevelopersnotes.com/articles/latest-browser-versions.php
It's not a web service, but you could simply parse that HTML and get the latest version of each browser. Alternatively, you could keep track yourself and manually update this information in your database.
You should only ever have to worry about IE when it comes to version enforcement. Exception being, of course, if you need a specific API that's just not available in previous versions of Chrome/Firefox, but in that case you'd look and enforce the API, not the browser version. Adding to that, if Chrome/Firefox don't have an API, chances are even the most bleeding edge version of IE won't either, so the point is moot. The fact is Firefox and Chrome, and in part Safari, are far ahead of IE when it comes to browser hosted capabilities that trying to enforce specific versions of the former would likely be a lot of wasted time and effort to yield nothing substantial.
The best I could find was this. It has an export option that allows to export in JSON, XML...
I would strongly suggest that you don't check the browser version, instead try doing feature detection using, say, Modernizr.
What features of your client's site depends on specific versions of each browser? If you use Modernizr you could perform a check on a feature, say some video stuff, and if the current browser does not support that feature, then display a message to the user suggesting they upgrade their browser.
Detecting browser versions via Javascript is very flakey at best.
The only reason I'd say you need this kind of verification is because your webpage has features only available to latest browsers. Instead of relying on version numbers, I suggest learning Modernizr.js for your website.
http://modernizr.com/
It can detect particular html5/css3 features individually.

Javascript and Sqlite

I am creating an app using HTML5 and Javascript. This app will be compatible with Windows and iOS 6 (iPad). I need a local database access using javascript. This is a pure offline ap with no server side involved.
My dilemma is -
WebSQL is not supported anymore by W3C.
IndexedDB works with Firefox but not with iOS6.
Most importantly, I want to avoid HTML5 Local database storage as it cleans data whenever history is cleared.
I would like to have a durable database locally for the app, something like SQLite. Is it possible to access SQLite using pure javascript, so that it will work with Firefox on Windows and also on iPad.
EDIT: The app will not be run from the browser in iPad (iOS6). Rather the app will be packaged into ipa file and installed in the iPad device.
What you're looking for is a polyfill.
According to HTML5 Please, IndexedDB Polyfill implements the IndexedDB APIs over WebSQL. (The author of the polyfill also wrote an article on Mozilla Hacks about it.)
Facebook also as a polyfill. According to this pull request (to another project), Parashuram Narasimhan, the author of the first polyfill, seems to prefer the Facebook polyfill and is considering retiring his own project. (But then again, the Facebook repo looks like a one-time code dump and may not have any ongoing development.)
There are some points to note.
Its a pure client side app.
Not using webstorage (local and session)
The options left are using webSQL, IndexedDB, Third-party framework or custom solutions.
webSQL :- Support is limited to webkit browsers and w3c declared its dead. Browser support
IndexedDB :- Supports in IE10, chrome and Firefox. Browser support. Not supported in older versions of IE.
Third-party framework :- sequelsphere is a platform independent solution to address this issue. It is a RDMS written entirly in javascript and make use of webSQL or IndexedDB.
custom solutions :- Supporting both IndexedDB and WebSQL on a cross platform web app like this tutorial, we can create our custom cross-browser db solutions or may use lawnchair like json storage options.
We had same issue and got answered on this thread.
Lawnchair is a good choice if you need a single table DB - we had requirement of multiple tables, so have developed own wrapper.
Create a web app using HTML-5 and JavaScript, so that it can work for both desktop browser and
iPad. Make it hybrid using PhoneGap for making it iPad's native app.
Please check whether this might be helpful. you can use javascript for both front-end and back-end (for db interactions). There are so many plugins also available to use for this framwork. http://www.nodejs.org
It's 100% possible. I can recommend a javascript lib for data access in html5 sqlite.
Documentation & sample code: click here
I have made a android demo (by using phonegap) with that lib. It works great!
Download the demo here

ActiveXObject in Firefox or Chrome (not IE!)

I am trying to create an ActiveXObject (to use FileSystemObject) but it's only supported in IE.
Is there a way I can make it work in Chrome or Firefox? I need to read all the files in a specific given folder, and list those.
Well, is there another way to do it?
ActiveX is only supported by IE - the other browsers use a plugin architecture called NPAPI. However, there's a cross-browser plugin framework called Firebreath that you might find useful.
No for the moment.
I doubt it will be possible for the future for ActiveX support will be discontinued in near future (as MS stated).
Look here about HTML Object tag, but not anything will be accepted. You should try.
ActiveX resolved in Chrome!
Hello all this is not the solution but the successful workaround and I have implemented as well.
This required some implementation on client machine as well that why is most suitable for intranet environment and not recommended for public sites. Even though one can implement it for public sites as well the only problem is end user has to download/implement solution.
Lets understand the key problem
Chrome cannot communicate with ActiceX
Solution: Since Chorme cannot communicate with ActiveX but still it can communicate with the API hosted on the client machine. So develop API using .Net MVC or any other technology so that through Ajax call it can communicate with the API and API communicate with the ActiveX object situated on the client machine. Since API also resides in Client machine that why there is no problem in communication. This API works as mediator between Chrome browser and ActiveX.
During API implementation you might encounter CORS issues, Use JSONP to deal with it.
Pictorial view of the solution
Other solution : Use URI Scheme like MailTo: or MS-Word to deal with outlook and word application. If your requirement is different then you can implement your customized URI Scheme.
ActiveX is supported by Chrome.
Chrome check parameters defined in : control panel/Internet option/Security.
Nevertheless,if it's possible to define four different area with IE, Chrome only check "Internet" area.

What Local Databases are avaliable for Javascript?

I'm developing a project in Server Side Javascript (SJS) using POW webserver. The result of the project will be a local application for users that will interact with a sort of "Database" of Answers and Questions (It's like a Quiz Builder).
Actually we are just starting and we are storing informations into JSON files (POW allows read/write of plain files), but I'm looking for a more efficient way to store and recall information from the DB (something SLQ-like).
Is there any possibility of doing this using Javascript? One of the requirements is that the user doesn't have to install a DB server (Mysql, Sqlite ecc) so it should be a Javascript-pure way, or even XML-HTML5 way (I'm not going to use WebDB or similars).
There are two client-side database features in modern browsers: IndexedDB and Web SQL.
Neither is fully supported across the current versions of the various browsers, but IndexedDB seems to be the one which is going to win -- the Web SQL is apparently no longer being maintained, and may be dropped entirely.
You can find out more about them both, and their respective browser support on the CanIUse website.
[EDIT] As mentioned by #Raynos, there is also LocalStorage, which actually appears to have much better cross-browser support than either of the other two mentioned above. Given the browser support (even IE8 supports it!), this would seem to be the best option for the time being, even though it isn't as fully featured as the other options above.
Here's the CanIUse details for LocalStorage.
Hope that helps.
POW provides simple access to SQLite DB, saved in pow/data folder.
http://davidkellogg.com/wiki/Pow_db

Categories

Resources