I am developing an Edge extension, I need to send data from it to WPF application. In Chrome extension, i use $.post to send data like this:
var listener = "http://localhost:60024/";
$.post(listener, postData);
And in WPF application receive this data with HTTPListener:
_listener = new HttpListener();
_listener.Prefixes.Add("http://localhost:60024/");
_listener.Start();
But in Edge this does not work, because $.post dont do anything. I have seen that Native Messaging can be used, but I do not know if it works with WPF applications.
Could anybody help?
But in Edge this does not work, because $.post dont do anything
In this issue, The MS Edge Team says that accessing localhost in Edge extensions is blocked by design:
"We are working on Native Messaging for the next release and using native messaging is the right way to solve this scenario. Localhost access is not enabled from extension background page is by design."
So, you could try to use an external API to transfer data. Please refer to this similar thread.
I have seen that Native Messaging can be used, but I do not know if it
works with WPF applications.
Microsoft Edge extensions are able to use native messaging to communicate with a companion Universal Windows Platform (UWP) app. More details, please refer to Native messaging in Microsoft Edge.
Related
I am trying to get Native Messaging between my chrome extension and my c# application. But below are my questions :
How to open only one Native app at a time ?. Clicking on the extension again will open the Native app again & again.
Can I communicate with an already open native app?
I built my extension and native app using the code in the following question.
Native Messaging Chrome
Native Messaging works by starting a new application process, then communicating with it over STDIO as long as Chrome keeps the connection open. If you don't keep the connection open, you can't "reconnect" to an application. To keep the connection open, you'll probably need to open it from the event script.
See this question: How to get Chrome Native Messaging to Listen to application? It discusses some of this topic, including C#-specific ways to keep it a single instance.
Furthermore, consider using alternative solutions, such as web communication (for example, WebSockets) to a local port exposed by your native code, though it creates new security questions (how to make sure it's your extension talking to it?).
I have this project where I need my webapp to talk to a chrome extension. The documentation to get your webapp to send requests to this chrome extension is unfortunately for javascipt. So I'm wondering if someone can point me in the right direction to the equivalent feature in flutter (library or methods).
Here is the documented way of sending requests to the chrome extention:
https://www.icondev.io/docs/chrome-extension-connect
I have a WPF app that stores credentials in a local file. I need to be able to access this file from an Edge extension or to somehow communicate the credentials from the WPF to the Edge extension. Can an Edge extension use the File API or is there something similar to Native Messaging for WPF that would allow me to communicate with the Edge extension?
As of builds 15002 and above (only available to Windows Insiders currently), Microsoft Edge supports native messaging to UWAs: https://learn.microsoft.com/en-us/microsoft-edge/extensions/guides/native-messaging
If you want to communicate with a WPFapp, you'll need to use the Desktop Bridge to convert it to a UWA before continuing.
If you need to sign up for the Windows Insider Program, you can do so here: https://insider.windows.com. Native messaging will also be available in the Windows 10 Creators Update once it's released publicly!
My question is similar to How to use OAuth with Github in a Safari extension, however, the answer there explains how to use oauth with the older safari extension API. I am trying to use OAuth with the new Safari App Extension API (https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/SafariAppExtension_PG/).
The new API allows the writing of native code, in addition to providing the ability to inject content scripts. Where should I perform the authentication? I also developed a chrome extension, and Google provides an API for retrieving OAuth tokens (https://developer.chrome.com/apps/identity) -- however I do not see anything similar for Safari App Extensions.
Any help is greatly appreciated!
I am currently working on Safari App Extension similar to your needs and the logic, certs (if you use them) persistence, access and refresh tokens all of them goes to the native code. From the SFSafariExtensionHandler you can control the active window/tab and all the pages in the tab, also receive callbacks from the pages.
For the OAuth use any native lib. that solves most of your needs for the logic. I am using this one from AeroGear.
Some adaptation will be needed for the page controlling.
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!