How to remove HTML5 persistant databases in UIWebView? - ios

I have a native application that uses a UIWebView and notice that with sites like Google, they are using an HTML5 local database for storing information. I am using native APIs for clearing items out of the cookie store, but clearing the persistent cookie store does nothing to remove these local databases. Is there a way to remove them through a native API?
UPDATE:
Is there a way to do this through a non-native API or javascript?

You can run this JavaScript directly in your url bar:
javascript:localStorage.clear();
Note that local storage is same domain scoped, so it will clear the storage
of the current domain that you are.
Currently google uses it for google Analytics, adSense, etc.

You can remove all localstorage variables by using a function like this.
function clearStorage() {
for(var i in localStorage)
{
localStorage.removeItem(i);
}
}
Of course if you need to only get rid of certain variables or simply set them to default values types then this will have to be modified. I am not familiar enough with UIWebView or your use case to know which variables you would want removed.

Related

Android 11 Storage Access Framework - How to use files?

Hey there fellow devs,
I have come across a problem while migrating our app to the new API 30 standards with the storage access framework (SAF).
I have successfully migrated the file structure and am now using the internal (FilesDir) paths.
Getting images with the MediaStore-Api is also working quite nicely.
But there is one big issue I just can't seem to fix.
In our app, we are using the API "Mapsforge" for Offline-Maps.
This API is using a Java.IO.File-Object we get from a path to a ".map" file which is almost 2GB large.
This file does not come from us, it is a file managed by the customer and put onto the device for us to use, since all the ".Map"-Files are custom.
Since the SAF is returning an Android.Net.Uri, I can't seem to convert it to a Java.IO.File without copying the contents of the file and therefore using even more storage on the device.
Is there any way to use the SAF to get a Java.IO.File-Object I can use in code?
If not, then Android 11 is making it very hard for my Customer to manage his storage.
This API is using a Java.IO.File-Object we get from a path to a ".map" file which is almost 2GB large.
With luck, Mapsforge will offer more flexible APIs in the future. You may wish to contact them about their recommendations.
Is there any way to use the SAF to get a Java.IO.File-Object I can use in code?
No. After all, the user might choose something on Google Drive or another cloud storage provider, rather than a local file. Or, they might choose a file that is inaccessible to your app. Or, they might choose content that is stored in an encrypted file, which needs to be decrypted by the document provider. And so on.

String saved in IOS app, accessible from web browser. Best method?

As the title says, I'm looking for a string to be input in an IOS app and stored in a way that it would be accessible from a web browser.
Both editable and readable from web and the app.
From initial googling, I've come across Dropbox Datastore API but it is being deprecated.
What would be a good alternative for this?
Your intentions are quite scant. However, I assume you want a little more than just reading and writing a string. Inferring a bit more context, you should look at Apple's CloudKit.
It has API for iOS, OS X, and apparently now javascript. See this link for more details.
You need some code running on a server and a database to save the string, with an API to access this string from a client.
FireBase is probably the simplest drop in solution since it gives you a very basic example and a web based UI for testing (plus it updates in realtime)

Jquery mobile best way to store and retrieve data?

I'm new on jqm and see a lot of stackoverflow articles but what is the best way to store, pass and retrieve data in JQM ? I don't find example on the jqm site.
Is better to use global object, local storage, ... ?
Thanks to ezanker
See jqmtricks.wordpress.com/2014/01/22/… for passing parameters between pages. It is also no problem to use globals in a single page app. Use localStorage to persist items across sessions.

Does anyone know how to access CoreData from a WebView within an Adobe DPS app?

When IOS5 came out, Apple made localStorage not persistent (http://www.sencha.com/blog/html5-scorecard-the-new-ipad-and-ios-5-1). While a PhoneGap application can work around this using a plug-in, we're trying to do this from within an Adobe DPS app where there is no direct access to the IOS native API nor is there a plug-in model.
We've thought of the semi-ugly workaround of using a cookie for persistence of very small data, but this is not a great solution for larger blocks of content (say an XML file and images) that need to be stored offline. Anyone have a better solution?
Answer: No you can't access any native APIs from a webview in an Adobe DPS app, but you can use web storage.
As an alternative to cookies (which have a relatively low limit on data), you can use WebSQL or localStorage.
I've successfully used both in a DPS app :)
Anecdotally, I find localStorage much nicer to use than webSQL, but if you know SQL and need to store complex relationships it may suit your needs.
Without direct access to the IOS native API you will not be able to access CoreData that is for sure. I would say your only option is to use cookies as you suggested.

Was it able to retrieve data from a external web site which does not provide a API using YQL?

I'd like to retrieve data from a web site ,which does not provide a API
Can I retrieve data using YQL?
ie: Can I custom the data parse in the target URI with YQL?
Yes, you can. This is one of the most popular use case of YQL. Here is a sample. But it is not working when trying to retrieve data from web-page which is dissallowed for spider access (via robots.txt, for example).
Without knowing what you're trying to do, the only reasonable answer here is…
Yes.

Resources