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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -