Communicate between remote Chrome extensions - javascript

I need to develop a Chrome extension that will be able to send messages between instances of the extension (i.e. active Chrome browsers with the extension installed around the world) very quickly (like push notifications).
I understand that the regular Chrome messaging (even the external type) only works with extensions installed on the same browser, not remote ones.
I'm looking for the best, simplest solution, that will provide quick communication between the clients. The only way I thought about is to get some server running (I don't have one, so I need to find an online service), and run a script that will continuously receive/forward data. Is that the best way? Is there a simpler solution to set up for very simple communication between the remote extension instances?

Related

Is there an easy reliable way to transfer a file over local network using Electron / Node.js / terminal?

Are there any built-in methods in Electron / Node.js allowing to transfer a file over local network to another device?
I want to be able to send files locally from one computer to another (through an Electron app), but I also want it to be able to send files to smartphones.
How do I do it? Is it possible to just create a temp local server and download the file from another device by opening the URL (e.g. 192.168.0.x:x/file.txt)?
I tried using https://www.npmjs.com/package/quick-transfer which does exactly that, but for some reason opening the link on another device doesn't do anything.
As painful as it is for me to suggest... I'd recommend WebRTC for this, for these reasons:
It will make a local connection, when possible.
It will work over the internet as well, if required.
You can work around any firewall difficulties with TURN.
You will have compatibility with browsers.
You won't be opening up some server to a file that anyone on the network can get... transmission occurs over a secured connection. (This doesn't mean you can ignore other security aspects in your application however!)
Sample code: https://webrtc.github.io/samples/src/content/datachannel/filetransfer/
Commentary: It's amusing to me that in 2018, we still haven't solved the problem of sending a file from point A to point B. Network Neighborhood in Windows was the golden age, and now it's all screwed up with this newfangled cloud crap. :-) Obligatory: https://xkcd.com/949/

How to open an EXE file from a Client Machine through a Web Application using Chrome

How to open an EXE file from a Client Machine through a Web Application using Chrome?
I am able to open the EXE through Internet Explorer since I am using ActiveX Objects to open the Exe file through client side scripting. But since chrome does not support ActiveX I am unable to open the EXE from chrome. Can somebody provide an alternate way to open the exe from chrome?
I know it works if IETab addon is added to the browser for supporting ActiveX. But the client policy will not accept adding add-ons.
I am trying for a solution as such in WebEx websites where a temporary application is run once and each time it is accessed it opens in the temporary app without each time installing it.
Thanks in Advance..
Short and simple answer, NO! it's not possible just by using plain HTML5/JavaScript API, and thank god it's not possible or else the consequences would be devastating! Imagine any random website executing a file on your computer! That would be the worst security nightmare!
But, there are workarounds!
1. You can, for example, use Flash (but you shouldn't) or Silverlight but as mentioned the OP doesn't want any plugin-based solution so I guess they are not as useful.
2. Another solution would be to deploy a Desktop agent, if possible, and then communicate with it using a local Rest API and handle all the native access in that Desktop agent.
Still, the most preferred way would be to just ask your user to scan (or whatever) the document and upload it to your site.
More references can be found here

How to create a simple WebSocket Server in Chrome App?

I'm trying to develop a Chrome App that will work together with a Chrome Extension that I already created, wherein the Chrome Extension will send information to the Chrome App.
For this communication I thought use the WebSocket locally, in Chrome Extension I managed to make the Client, but now I'm having difficulty in creating the Server in the Chrome App, because I wanted to make as simple as possible without having to install something beyond of the Chrome App.
Among the first Google results there is a sample app from Chrome team: Http WebSocket Server.
You've got to understand that making a server in Chrome Apps is difficult; you are given access to a raw socket, and you need to fully implement the protocol that a particular server must use. Even a HTTP server is non-trivial, WebSockets is even less so.
So: it's possible, but it's not simple unless you're using an existing library.
Just to add to the accepted answer:
There is a Chrome Extension already in the Chrome Web Store: Web Server for Chrome.
And it is opensource: GitHub Link. You can use it as a library to your Chrome App.
Cheers!

How to easily run local content (javascript, Flash) especially in IE11

I've developed interactive content for a client ( VR Objects ) using javascript and Flash (if needed) that they now want to distribute to prospective customers via a flash drive. That makes it local content causing security issues especially with IE. Actually there doesn't seem to be much problem with any browser except IE. True, IE displays the "allow blocked content" button but they fear that is too complicated or scary. And on IE11 in Win 8.1 it still may not work.
The development environment I use has a way around that for testing using an "embedded web server" although all that seems to do is produce a localhost address such as http://localhost:60331/wyj-01xn/output/surfacide_flash.html. Paste that in the URL bar of any browser on the same machine and you are good. Try it on another machine and no go. So I gather the port address and whatever the /wyj-01xn/ is about are machine specific. Another possible problem -- it may not work easily with IE11 on Win8.1, but I don't personally have that setup to test.
QUESTION: Is there a way I can produce this same functionality for my client, distributed along with the content on the flash drive, without the need to install some special software (local web server) on each client computer??? The current workaround is to tell customers they should us any browser except IE. Client isn't happy.
You could distribute your webpages along with a portable Nginx server, or wrapped inside a Node-webkit or AppJS package.

Is it possible to externally trigger Javascript in Google Chrome from another process, maybe via an extension?

I'd like a local process on my machine to be able to trigger javascript in a specific tab in my local Google Chrome browser. The tab is not connecting to localhost, but to another known domain.
This may sound a bit weird, but what I'm actually trying to do is allow my in-browser music player to be controlled via global OS keyboard shortcuts, so I don't have to go to my tab in Chrome to pause or skip a track, for example.
I haven't been able to find any references to this type of behavior anywhere. Here are some solutions I've though of so far:
I tried looking at the Chrome Extensions APIs, and found the NPAPI Plugins which seem to allow javascript to trigger an external process, but I'm not sure if I could get it to work in the opposite way?
If directly triggering javascript is not possible, I may look into opening an HTML5 WebSocket to a tiny localhost webserver that can push control messages to the browser. I've read that WebSockets can function cross-domain in this way.
If both of the above don't work, I could always have a localhost process push to the remote server, which can forward the message back to my Chrome tab via WebSockets or another callback method. I really hope I can avoid this.
Are there features of Chrome extensions I'm overlooking that can be triggered externally? Or will a NPAPI plugin be able to do what I want? Or is there a better solution for this somehow? These all seem a little needlessly complex for such a simple task.
I would use the NPAPI Plugin becasue it is the best one too use for the thing your doing.
Good luck completing it.

Categories

Resources