开发者

call Javascript function from OUTSIDE the browser?

开发者 https://www.devze.com 2023-04-05 21:56 出处:网络
I have a Windows tray a开发者_如何学Pythonpplication that needs to communicate with my web-application, especially displaying incoming call information.

I have a Windows tray a开发者_如何学Pythonpplication that needs to communicate with my web-application, especially displaying incoming call information.

The telephony-application (ProCall) can start applications when a call-event is received.

I could open a specific URL in a new browser window, but ideally I would like to start a Javascript function of an EXISTING browserwindow and then do it with AJAX.

Is this even possible?


You could have your application talking to a local service via AJAX (with polling) or COMET and have the tray application either host that service or talk to that service. That way you could have a pretty easy channel of communication from your browser to the tray application.

Otherwise you're looking at something like an active x control as far as I know.


You can insert <script> tag on the page? If yes you can put inside function call, or other code


if you can change the javascript source, i'd say that the url you call have aditional GET/query string parameters, or a hash, and that your js parses it and act accordingly

if you want to use an existing window, you can probably get the instance using COM and with some method around change the hash of one of the open websites to send commands to javascript without reloading. i'm pretty sure it is possible to do something like that with IE, and probably with FF. of course, you need to create a desktop app that get the instances and call its methods. i'd recommend .net or a .vbs script


You want communication between two browser windows, but first you must start from the first step: How will you relate a browser window to another one? Why should A contact B not C?

The answer depends on this relationship. For example, if A is somehow causing B to spawn, it would be a matter of passing a "pointer" to B (which could simply be a session ID).

0

精彩评论

暂无评论...
验证码 换一张
取 消