Today's project involves interaction between native and H5 pages
1.doc ument. readyState
Document. readyState: determines whether the document has been loaded. Not supported by firefox.
This attribute is read-only and the returned value may be:
0-UNINITIALIZED: XML objects are generated, but no files are loaded.
1-LOADING: The LOADING program is in progress, but the file has not started parsing.
2-LOADED: some files have been LOADED and parsed, but the object model has not yet taken effect.
3-INTERACTIVE: only valid for some loaded files. In this case, the object model is valid but read-only.
4-COMPLETED: the file is fully loaded, indicating that the file is successfully loaded. [_ WebViewstringByEvaluatingJavaScriptFromString: @ "document. readyState"]; you can determine the loading status of the current webview.
2. Window. location. href with window. location. href can only be opened on the current page.
3. Execute JS Code and statements in ios; stringByEvaluatingJavaScriptFromString
4. Change userAgent
NSString * userAgent =
@ "Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_1 like Mac OS X; ja-jp) AppleWebKit/525.18.1 (KHTML, like Gecko) version/3.1.1 Mobile/5F136 Safari/525.20 ";
Id webDocumentView;
Id webView;
WebDocumentView = objc_msgSend (myWebView, @ selector (_ documentView ));
Object_getInstanceVariable (webDocumentView, "_ webView", (void **) & webView );
Objc_msgSend (webView, @ selector (setCustomUserAgent :), userAgent );