JavaScript localstorage between multiple web apps? - javascript

One of my web apps (for iOS) save something with javascript localstorage.
For some reason, I can access that data from that same web app, but not from another one, which is on the same website.
I really need to do this, so why doesn't it work?
And, more importantly, how can I fix it?

This is just a hack, you can use web messaging between apps to share localstorage data.
Resources you can find about web messaging
https://developer.mozilla.org/en-US/docs/Web/API/window.postMessage
http://www.w3.org/TR/webmessaging/

Related

Verify that a JS script only runs in whitelisted native apps

We have a chat interface that we allow our partners to embed into their websites and web apps using a JS snippet. We want to expand to integrating with native apps using WebViews.
I am seeking an approach to verify that our snippet is only running in specific apps.
As an example: A similar functionality that is easily achieved in web apps is a domain check.
A partner / client gets a JS snippet or a URL and a key,
on page load it looks up the partner details using the key,
if they're active and approved for this service,
check the requesting domain against a list of whitelisted domains for this key.
Is it possible to uniquely identify a native app from a JavaScript function that is running in a WebView to verify the app? Perhaps - are app store unique app IDs accessible from within a WebView?
Thank you
No, it is not possible to uniquely identify a native app from a JavaScript function that is running in a WebView.
"No" is a hard answer to find on the web. Phone a friend informed me that while some native information and functionality is accessible from within WebViews, the app ID or bundle identifier is not exposed programmatically. Of course a developer could add it, but that's not helpful in verification.

Should I use Local Web Storage as a Database for a small website?

I am creating a forums website for a roleplay with my friends and not many people are going to use it. But I want to add a feature of user creation, deletion and login/logout.
Should I use Local Web Storage of the browser as a database for that or should I look into other alternatives?
Thank you in Advance
No. You should buy an online service, e.g. AWS Cloud Databases. And you also need an online web server.
Local storage is unreliable, and easy to lose when cleaning browser caches.
If you are new and want to experiment, you can try using services like AWS amplify. You can build full blown website without having to worry about storage or anything. Also you don't have to worry on pricing as it would cost based on the usage and ideally cost nothing as you can use the free tier.

how to set multi paged website using firebase?

i'm working on a basic website using html/css/js and Firebase fire-store to store data along with authentication to authenticate users, my website consists of multiple HTML pages which most of utilise Firebase services, and i'm wondering what would be the best way to allow all the pages (and the scripts within them) to utilise the Firebase?
should i copy the Firebase SDK and configuration code snippet into each and every html page? i believe this wouldn't be a good practice and i doubt it would even work well..
how can i achieve what i want? is there a certain Firebase service that allows me to achieve it?
Firebase comes with a JavaScript SDK for Firestore, that you can use in your scenario.
The most common way to set up such a web app is as a single-page application, so that all HTML, JavaScript and CSS is loaded into a single page without ever reloading an entirely new page. This has the big advantage that you're only loading the Firebase SDKs once.
If you have multiple HTML pages, you will have to load Firebase into each page where you use it. But on all but the first page the SDK will likely be loaded from the user's browser cache, but it'll still be a lesser experience than with a single-page application.
For a good introduction of a single-page application, I recommend taking the Cloud Firestore for web developers codelab. As a more introductory tutorial to building single-page applications with Firebase and Firestore, I'd recommend Get to know Firebase for web and its companion video.

Access data from webView in cordova/android

I have following situation and didn't find the answer to my question in my searches. I am sorry if I overlooked something.
I am using cordova for an android app. This app isn't more than an existing web page/web application repackaged as an android app. This web application gets data using existing and working api calls in form of http requests.
All good, but this data is only available online. I need to build a local database in android to have the data available offline as well.
Question: How do I access this data and put it into an Activity?
Thank you in advance
You can use localStorage to do that.
https://cordova.apache.org/docs/en/latest/cordova/storage/storage.html
If you want to save a json than you will have to stringify it first.

Is it possible to connect your background script to mongoDB server? If Yes, How?

I am creating a google chrome extension. I have a background script from which I want to send and retrieve some data from MongoDB database. How do I do that? I'm new in chrome extension development.
YES. It's possible. But, It's not a good idea to expose a database to the public internet at all. Implement a REST like method in your backend code and authorize calls to it using some web standard auth scheme, such as OAuth or HTTP Basic auth. Hitting the DB directly is way too dangerous. You can receive/send data from DB accordingly. Saying That if you still want to go ahead here's a link to help you with that For full REST capabilities, consider using an external REST Interface such as Sleepy.Mongoose.

Categories

Resources