Situation:
I am coding an application, this application is loaded by wkwebview, I want to implement F7 and native interaction (Except for cordova, I heard that its performance is very poor.) I tried Google but no results, (js is not me Work, but the team is me alone, so I took it)
My progress:
- In JS I use
window.webkit.messageHandlers.callNative.postMessage(message)
to call native (iOS), it works. - in iOS I use
evaluateJavaScript:"js code"
to call JS, but it only works in index, when I write in other pages (such as product.f7.html), iOS call error, can not find this Method, I guess the reason for f7 (I just guess, I am not a professional js) - I made progress with some answers How to get JS callBack in WKWebview?, but it must be initiated by js and then pass the callback function to iOS. Then called by iOS.
my question
- How to take the initiative to call js via iOS, don’t use cordova (if you recommend cordova, please tell me why)
- Is my method or direction correct? Recommend me to do this?
- I have never used f7 before (I have hardly written JavaScript), so where can I find files or projects that I can refer to? I looked at the official documentation for framework7, but it doesn’t seem to.If you can provide some examples or links to the reference, I appreciate you.
If I have a description that is unclear, you can ask me, I will upload my code.