Persistent client-side web storage - javascript

We are developing in-house web-based application for viewing data reports while targeting on smartphones and tablets. Our customer asked us for possibility that only certain devices could access the content. Hence we use technologies based on javascript/HTML5 we are no capable of reading unique ID like IMEI or device uuid. My idea consists in making random ID (very simple) and storing (not simple) such an ID on server and device using:
localStorage,
cookies,
html5 file api,
webSQL,
indexedDB
wrapped in http://amplifyjs.com/api/store/
or http://samy.pl/evercookie/
The problem is that abovementioned techniques are not quite persistent. They are vulnerable to cookie and/or cache cleaning.
Can we make such an ID "more" permanent or could You find any other workaround to allow connect only certain devices to the site?

Related

How would a cloud app get the client's local device information?

How would a cloud web app get Client Device Information such as IP address, Serial Number, etc?
Looking to have an app developed for tracking asset conditions within the school. Just want to make sure my ask is possible before I list it for review.
Basically the user goes to a webpage and fills out a condition report and submits it. I'm wanting to automatically identify the Chromebook or Laptop that is submitting the condition report. With Chromebooks especially, the S/N on the board is not what always is on the case plastics (due to repairs). The aim of making this automatic is to keep data correct.
I could identify the device by serial number, asset number, or local LAN IP. Could potentially identify by any other persistent hardware id that doesn't change.
Thoughts on possible solutions / workarounds:
Maybe there is a unique hardware hash or identifier that Chrome supplies that is persistent and I don't know about. I could manually build a lookup table if its not appropriate to use it directly.
It looks like the WebRTC method no longer works for obtaining local IP address - unless there is a way to force the Chrome Flags for specific sites through Google Workplace policies.
I could create a web service that runs behind the firewall and returns the IP address of the requestor. The client side JavaScript would use that when communicating with the cloud web app and if it cannot connect to the local web service then it prompts the user for the serial number as a last resort.
I could create and force install an extension that the webpage can use to obtain the IP address...
E.g. https://github.com/DoctorLai/what-is-my-ip/
Just wondering if there is an easier way than the above ... One that would work even if the Chromebook wasn't on site...
Thanks

How to allow only 1 vote per person(computer/mobile) on 1 post at website without making user accounts ?

I'm recreating Yik Yak mobile application as a web application in process of learning Meteor framework. But that app is completely anonymous without user accounts, but still you can upvote or downvote post only once. How to make this work ?
What you want will probably require more than just JavaScript, and some back-end code (with the language of your choice).
If it's a website, you can try to identify a user by the IP/MAC address of his/her computer. But the problem is that it is not going to be reliable (e.g.: users could hide behind fake addresses, or multiple users could use the same IP). You can read about some methods on this question (PHP).
If it's a mobile application, use the unique device ID (but again, that will require more than plain JavaScript).
On Android: Settings.Secure#ANDROID_ID (read more on this question)
On iPhone: [UIDevice currentDevice] uniqueIdentifier (read more on this question)
On Windows Phone: DeviceExtendedProperties.GetValue("DeviceUniqueId") (read more on this question)
If you are using Cordova/PhoneGap to create a web app, you can use the device.uuid to get a unique identifier (read more here)
With the unique device ID (UDID), you can identify what device voted, without knowing who is the owner of that device and without forcing your users to create an account/log in.

Offline storage for mobile devices?

I am writing a mobile website that needs to store some data offline, and to sync that data when there is an internet connection. It is possible to use HTML5 Web SQL Databases, but there's a space limit of 5MB. I am wondering:
Can I create multiple databases in HTML5 Web SQL Databases, so that the total size can exceed 5MB?
If not, is it possible to store offline data into a local database app (if there is any) installed on smartphones?
Thanks.
Web browsers will eventually support file access using a sandbox. But for now you are limited to webStorage, Web SQL, or indexedDB along with a data limit per domain.
Here is information on webStorage, maybe you can put some data there.
Here is some information on web SQL., but it looks like web SQL is being deprecated in favor of indexedDB. So you might want to re-consider your direction.
This would likely be your best bet - indexedDB. It is a form of no-SQL storage. Check the spec. for limits. SO won't let me post the link, but it is in caniuse as well.

Offline app : use HTML5 Filesystem API to store MySQL database

I need to build a PHP/MySQL app that allows offline access on iPads (for travelling salesmen often in deep country without internet connection). I have to manage a daily (or on demand when the device is online) sync between the local data and my remote server. I have a large database, which cannot fit in the 5M localStorage limitation. IndexedDB or Filesystem API are not available on Safari (according to http://caniuse.com/).
Is there other ways that would be appropriate to get it done?
Can't you use WebSQL? ( see question What is the maximum size of a Web SQL DB in iOS (Safari) on the iPad? How about LocalStorage? ).
If you coded it for LocalStorage you could easily use that LocalStorage API to access WebSQL on iOS devices...
Perhaps a jump to PhoneGap would solve some of your problems?
Do you need to store ALL data from your database?
I have a library for doing Syncrhonization, it's LocalStorage at the moment but the next update will allow me to use nearly any storage mechanism as it only needs one index. Purging data that is no longer required is on the list too... It's located at https://github.com/forbesmyester/SyncIt and you can even see a presentation courtesy of SkillsMatter / LondonAJAX.

Different ways to store web data Locally

Is there anyway to have a client side small database that syncs with server side database whenever there is a change in data?
So I am looking at writing a javascript program to store a bunch of student application forms. But the internet connection is gonna be unstable as the personnel using it will be moving around campus to collect form data on his tablet.
I have looked at localstorage, but it does not have any database features.
I am really looking for technologies that can do local database entries and make asynchronous syncing easy (like what dropBox did was awesome except that it is not a web application)
I hope my question is clear
Thanks
It depends upon what kind of support you want.
Check out http://diveintohtml5.ep.io/storage.html#future where they talk about the Web SQL Database specification and IndexedDB.
It may work (Web SQL Database that is), since it sounds like a controlled environment.
following storage mechanisms when available:
Standard HTTP Cookies
Local Shared Objects (Flash Cookies)
Silverlight Isolated Storage
Storing cookies in RGB values of auto-generated, force-cached
PNGs using HTML5 Canvas tag to read pixels (cookies) back out
Storing cookies in HTTP ETags
Storing cookies in Web cache
Internet Explorer userData storage
HTML5 Session Storage
HTML5 Local Storage
HTML5 Global Storage
HTML5 Database Storage via SQLite
Copypasta from evercookie description. Several items were removed because too short lifespan and/or too few space. Do not borrow his code, tho, it uses jquery and is clumsy in the other ways.

Categories

Resources