javascript - Mac app to comunicate to web app in safari -
can point me in correct direction developing mac app can communicate safari site? don't want use web views, want communicate website in safari itself.
i have site sending messages native app fine using app url scheme (app name://some/url/).
ideally our app provide single sign on our little internal site , trigger in page js events reloading data etc.
i havne't been able find documentation on this.
so here ended doing, it's quite convoluted if has better suggestion please let me know.
my mac app 2 things when starts
- creates the directory ~/.appwebserverfiles
- starts simple python webserver above directory it's root
the mac app can write token.jsonp directory, one:
singlesignoncallback({"token":"sometokenthinghere"});
the website using jquery make ajax call so:
$.ajax({ url: "http://localhost:8585/token.jsonp", datatype: 'jsonp' });
when ajax complete, since datatype of jsonp excecute js finds in it. call function called: singlesignoncallback()
i can inject js our internal webapp using this.
edit: should add works browser.
Comments
Post a Comment