Common HTML5 knowledge

Source: Internet
Author: User

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 );



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.