Add window.navigator.standalone to UIWebView DOM

Do you know how "webapp" can be installed via Mobile Safari by clicking the + button? And by launching this application through the home screen, your webapp knows that it was launched from the desktop, because it is window.navigator.standaloneset to 1 ...

Well..

I made an iOS app with UIWebViewthat loads a web application. And now I would like to add a property window.navigator.standaloneto the dom of my web application ... is this possible?

thank

+3
source share
2 answers

Paste some Javascript into the web view from the C object to manually set the parameter

[webView stringByEvaluatingJavaScriptFromString:@"window.navigator.standalone=1"];

-dx

+1
source

. navigator.standalone , . iPhone Emulator Inspector.

0

Source: https://habr.com/ru/post/1761085/


All Articles