In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "how to solve the plusready compatibility problem in HTML5 API". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "how to solve the plusready compatibility problem in HTML5 API" can help you solve the problem.
Android platform injects 5 + API in advance, which can be called before the plusready event.
In a 5 + Runtime environment, 5 + API is usually injected after the parsing of the html page is completed, and the order of execution is as follows:
1. Load the html page
two。 Parse html pages (download resources referenced by nodes such as script/link, such as js/css files)
3. Trigger DOMContentLoaded event
4. Inject 5 + API
5. Trigger plusready event
As a result, the effective time of 5 + API is delayed. 5 + API can only be called after referencing js execution in html. Usually, the following code is used to call 5 + API:'.
Document.addEventListener ('plusready',function () {/ / call 5 + API / / for example, get the device unique ID plus.device.uuid}, false)
However, in the new version, the injection of 5 + API in advance will be supported. You can call 5 + API before the plusready event is triggered to introduce nodes ahead of time:
Compatible writing:
If (window.plus) {/ / call 5 + API} else {/ / compatible with the older version of plusready event document.addEventListener ('plusready',function () {/ / call 5 + API}, false) here;}
Be careful
1. Just injecting 5 + API in advance will not trigger the plusready event in advance (only step 4 is done in advance)
2. Advance injection is supported on Android3.0 and above platforms, and cannot be injected in Android2.* version.
3. Wap2app in the streaming application environment is automatically injected in advance (when the network js is referenced for the first time), and there is no need to add nodes
This is the end of the content about "how to solve the problem of plusready compatibility in HTML5 API". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.