Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to share the locastorage data among UIWebView (native app) and safari?

I want to create one localstorage variable from my native application with the help of UIWebView and want to access the same varaible on safari.

Consider I set the localstorage variable for URL: http://localhost:3000/index.html from native application and want to access the same on safari.

like image 249
ajay agrawal Avatar asked Nov 22 '25 12:11

ajay agrawal


1 Answers

This is deliberately not possible because of native app sandboxing. One app cannot access another's data including UIWebView's cookies, localstorage etc. This includes no sharing of information between Safari and third-party apps.

The closest you are likely to come is to have your app launch a URL that will open in Safari and fetch a script from your server that sets the value you require.

Apart from the obvious disadvantage that this would switch out of your app and into Safari when you set the value, you'd also have to be very careful not to open all sorts of security holes, depending on what the localstorage data is used for. You'd at least need to do extensive sanity-checking of the data being stored.

like image 56
CupawnTae Avatar answered Nov 24 '25 03:11

CupawnTae



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!