0

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?

kaspianh
  • 3
  • 3

1 Answers1

0

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.

Zhi Lv
  • 18,845
  • 1
  • 19
  • 30