Shared IndexedDB store between different web browsers - javascript

Using Dart lang, I've generated an application that stores several list of objects. I'm very happy with the result, congrats to Dart Team, but I have a question:
If I store several data using Chrome, is there any way to read this info from other web browser, i.e. Firefox.
That's why the user works with several web browsers in the same machine, he/she doesn't care which browser is open at that time, he/she wants to use the application in the current opened web browser.

Browsers can't access each other's data directly, but, given your diagram, it looks like IndexedDB is on the shared server and not in the particular browser so I can't see the problem.
If you have your database running on local server and it is accessible only with Dartium and for some reason you don't want or can't compile the browser part to JS(with dart2js) or do something else to make it accessible from the browsers without DartVM. then I can think of 3 ways how to perform browser to browser data transfer without the server(on which application is hosted):
With HTML5 Drag and Drop between browser windows.
Creating WebRTC client\server and transferring the data this way.
Using remote server and simple authentication with Gmail,Facebook etc. [the reasonable way]

Related

Create an extension to the browser to acces local scanner

I would like to access a special hardware (a penta scanner, for the wisest ;) ) from a web page.
The aim is to retrieve the information from the scanner and compute it on server side.
The problem here, is that I have to summon functions from a DLL that has to be on the client side. I have two leads for that:
Develop a COM DLL and use ActiveX
Try to get through a homemade extension for a web browser in order to communicate with the local DLLs.
I've tried the first option, and I got stuck and I've posted another thread about it. Anyway, even if it works, there are too many constraints about it (as to use IE or the fact that even Microsoft is not fond of this feature and banned it from edge).
The second method is something that I found on another forum but, I do not understand how I can interact with a browser extension (whatever the browser).
So what I am asking is:
Is it possible to use a web browser extension as a medium to a local DLL and if so, would you be so kind as to give a hint about how to do ar anything that might look like a start about how to do it (even just some key words to use on google, since mine didn't get anything)....
Thanks.
Based on my understanding, the motive to develop an Extensions is to enhance the feature and functionality for particular web browser.
You cannot control any hardware devices like printer or scanner with it.
So if your goal is to control the scanner from your web page with the help of any kind of extension than I think you cannot do this with Extension.

Create hardware specific key from any web browser

We currently have a web browser application that runs only under Internet explorer that we are trying to make cross browser. The main reason for using IE is that we can access the hardware information from an ActiveX control. We would like to get away from this methodology for obvious reasons.
If we forget about the way things are currently being done and go back to the security requirements and look for other ways to accomplish the same thing. The user of the application must be on a known computer that must be in a secure location. I am at a loss on how to do this.
We currently use Protect/unprotect to encrypt the data we need and guarantee that the file can only be decrypted on the same machine. This keeps the user from finding the file and copying it to another machine and running. The file is put on the computer by a separate installation process that can only be run by authorized personnel.
So how do I get a machine specific key of some type that allows me to identify the computer with no chance of being replicated to another computer?
====================================
We are trying to do exactly what the web is trying to keep us from doing, so this may not be doable without specific browser extensions, such as a ActiveXControl.
The USB response is interesting but it does not guarantee location. We do use USB devices for terminals that require 2 factor authentication.
The other possibility is a user or machine certificate installed in the computer. The problem I see with that is the certificate can be exported. We had tried this years ago and the operational overhead was too high.

storage space for mobile app using html and js

Okay, we talk and hear lot about creating mobile app using javascript and html. I was trying to write one app myself forgetting that some real programs also need to store and access at least, the information stored by the program. I intend to user only the browser of the mobile app and it is offline. Basically, it is just a program written using js. Since the browser is not allowed to create and store the data in the user's disk, how should I approach it? Storing the data in cookies is one of the option, I guess. I am new to web programming so please bear with me if I say something stupid. However, cookies can be inadvertently deleted.
So my question is: How can I manage a 'small storage space' in mobile device if I am using a html and js to create my app?
Web storage is supported by almost all modern browsers
http://caniuse.com/#feat=namevalue-storage
If you are looking for offline web applications, it is not supported from old Internet Explorer
http://caniuse.com/#feat=offline-apps
Here are a couple of useful links:
http://diveintohtml5.info/storage.html
http://diveintohtml5.info/offline.html
I believe all modern phones support LocalStorage.
In HTML5, there are a couple of ways to save information the way you want.
LocalStorage and WebDatabase
Although, if you want to do an App for iOS I recoment Web Apps, that allow you to create offline HTML application that the user see as a normal app.

Can the OS as well as javascript/HTML5 access localstorage?

I would like to read the browser's "localstorage" when the browser is off using the OS !
I want to save client data in localstorage and then switch off the browser and the internet and then let an OS program (a windows exe) access and analyse that data and then write new data into that localstorage area so that when the browser restars the new data is in localstorage.
This should be possible because my OS (i.e. windows) can read can delete cookies from the browser "files" ... so presumably once i know the format of the localstorage "file" then the OS is boss of all of its files and so it should be able to alter them !
So: how do i read and write to JavaScript/HTML5/DOM "localstorage" using "client side .exe programs" ?
FAILING THAT: is there any other way that the OS can pass simple data into (and out of) the browser ?
Obviously all of this has both huge potential POWER and huge potential DANGER !
The browser can only become the "virtual OS of the future" if the real OS can interact safely with it !!
Thank You.
Of course an app running locally with the appropriate permissions can access any file on disk. However, the real question is what to do with that file once it's open?
Consider the following:
Each browser (Chrome, Firefox, IE, Opera) is likely to store localstorage data in its own proprietary format. You'd have to reverse engineer those formats.
Since those formats are an implementation detail (not a documented API), they are liable to change. This will break your app and/or corrupt user data.
What happens if you modify those data files while the browser is open (even if the page in question isn't open)? The browsers don't expect their data files to change out from underneath them, so it's likely you'd see strange behavior.
All of this is to say that this is a very bad idea. You're messing with the internals of someone else's application; that's a big no-no.
Have you considered an alternative approach? When I was faced with a similar problem, I simply implemented a very simple HTTP server in my app that was bound to a specific port on 127.0.0.1.
With XHR and the appropriate CORS headers, your browser-based application can communicate with your desktop app in a safe manner.
Here are some other ways:
Embed a web browser control in your application. The web browser control can readily peek into the page, and the page can readily peek into the local storage. The web browser control refers chiefly to Internet Explorer.
You can pass parameters from the web page into an initiated executable (even a batch file) by manipulating the name of the executable. (Use application/bat as Content-Type to invite the OS to run your program when the user downloads it.)
A ClickOnce program initiated from the browser can readily receive data from the webpage.
You can use automation in your program (AutoIt, AutoHotKey) to copy/paste to an from a field on your web page. You can find the window by title as you control the title on the web page side. You can even automate opening a browser, navigating it to a page that dumps the local storage into a text field, and focuses the field.
ActiveX controls (good luck)
I can't speak for similar tricks for OS X or Linux.

How might I send messages (strings) from a Win32 app to a Javascript program running in an existing IE window?

I have a system tray icon that receives incoming phone calls. When a call comes in, I want to send the phone number into a web app that does stuff on that phone number. We can launch the web app with the phone number in a query string, but if I launch a new window for every call, it will junk up the user's computer with lots of browser instances, would not preserve the location/size the user moved the browser window to, and would take longer than just refreshing the page. Instead, I'd like to make the Win32 app re-use the same IE browser window and just send the web app the new phone number every time a new call comes in. I'm envisioning somehow sending a Windows message, or somehow instructing the IE browser to run a certain javascript event with some data? I can see why doing the reverse (javascript out to Win32) would be a security issue, but this would be just sending a message from Win32 to javascript.
So I'm specifically NOT asking how to do what's been answered in this question: How to Interact Between Web App and Windows Form Application
That user was asking how to launch a Win32 app from Javascript and pass data to the win32 app. Roughly, I need to do the opposite. I need to send data from a Win32 app into a running javascript program.
Note also that I'm not asking how to launch one IE window with arguments to Javascript one time; I can easily do that with query strings. What I'm asking is how can I / is it possible to pass data from a running Win32 app outside the browser to a running Javascript app inside a browser window.
Since you can send the phone number to the site through a querystring, all you really need to do is tell IE to navigate to a URL of your choosing.
To that end, you can use what is in this KB article to help you find the instance of IE you want to connect to.
http://support.microsoft.com/kb/299356/de
Granted, its in Visual J++ of all things, but since you are interacting through COM Automation, the calls should be easy to translate.
Once you have the instance of IE (in the form of an IWebBrowser2 interface implementation) you can simply call the Navigate or Navigate2 method with the URL you need (with the phone number in the query string of course).
You should be able to find the handle of the IE window, and then send messages (keypresses perhaps) to it. Use a bit of javascript to capture all keypress activity and you have a very simple method to transfer information.
It won't be easy (the devil is in the details - issues of focus, etc) but it should be possible.
-Adam
What you need is a way to How To Connect to a Running Instance of Internet Explorer
(caveat: this one is in Java, but you should be able to translate it to C# quite easy).
Or you could enumerate the top-level windows to find a particular instance of IE and then Get IHTMLDocument2 from a HWND (this one is in C++, so you might need to do some Win32 interop; you can find all necessary declarations on PInvoke.net).
If you search on your friendly local search engine for How to connect to a running instance of Internet Explorer, you will find a lot more info.
Once you get to the document, you can either invoke the JavaScript function through the document scripting interface, or you can just navigate it to your page and pass the phone number as a parameter.
you could possibly get around the security and other issues with this method by using a web service on the web server, and have the win32 app update the web service and have the web page poll the same web service every however many seconds. Then you the the option of mapping that number to a database and getting additional information.
The only draw back is that instead of being immediate, there is a delay to get the information displayed in the browser.
How about you write an active-x control that you create in the browser using Javascript. This is effectively an Explorer browser plugin. Same idea for Mozilla, etc., except they use a different plug-in structure. This lets you support other browsers in the future.
The control can talk to your win32 app using a pipe or a socket or whatever type of inter-process communications and is then accessible as a Javascript object.

Categories

Resources