S
S
soofftt912016-08-13 01:18:27
JavaScript
soofftt91, 2016-08-13 01:18:27

How to establish command/message exchange between scripts?

I am writing an application in Electron.
On the page there is an element <webview>in which the instagram site is loaded. Also, using the preload attribute , a script is connected to this site that should perform various actions on the Instagram site.

<webview id="webview" preload="./js/inject.js" src="https://www.instagram.com/"></webview>

Is it possible to somehow arrange the exchange of messages / commands between the application scripts and the script connected via preload ? Those. I need to send commands from the application to execute on the page in webview functions from a script connected via preload.
I hope I explained everything clearly.
-------------------------------
PS At the moment I am implementing the interaction between the application and the page in <webview>this way. I write all the logic in the scripts of the application itself, and <webview>send only commands to the page.
var obj = document.getElementById('webview');
obj.executeJavaScript("$('._fcn8k').remove();");
In this case, you do not need to connect anything via "preload" at all.
I would like to know how to do without my bike.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2016-08-13
@soofftt91

Looks like what you need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question