Weex and Web Platform differences

Source: Internet
Author: User

Weex is a cross-platform solution, and the Web platform is just one of its operating environments, and in addition to running on Android and IOS Clients. The difference between the native development platform and the WEB platform differs in both the functionality and the development experience.

No DOM in Weex environment

The DOM, the Document object model, is the programming interface for HTML and XML documents, and is a concept in the Web. Weex's operating environment is primarily native, rendering native components in both Android and IOS environments, not DOM Element.

DOM Operation not supported

Since the web API is not supported in the native environment, there are no objects such as,,, and Element Event File so on, and the detailed list can refer to Web APIs on MDN. Selecting elements, such as, etc., is not supported, and document.getElementById document.querySelector the DOM API-based libraries (such as JQuery) are not supported.

Limited event types

Weex supports binding events on tags, as in browsers, but events in Weex are captured and triggered by native components, and behave differently from browsers, and properties in events differ from those in the Web.

    • Does not support all event types on the Web, please refer to the General Events section for Details.
    • The capture phase and bubbling phase of the event are not differentiated, and are equivalent to DOM level 0 Events.
No BOM in Weex environment

The BOM (Browser object model), which is the browser-based, is the interface that the browser environment provides for Javascript. Weex does not run on the native side and does not support browser-provided BOM Interfaces.

No windowscreenObject

Weex and objects are not available in the browser window , and the screen use of global variables is not supported. If you want to get screen or environment information for a device, you can use a WXEnvironment variable.

    • WXEnvironment
      • weexVersion: Version of Weexsdk.
      • appName: The name of the app.
      • appVersion: The version of the app.
      • platform: The operating platform, the possible values are Web ,, Android , iOS one.
      • osName: The name of the System.
      • osVersion: System Version.
      • deviceWidth: Device Width.
      • deviceHeight: Device Height.
No documentObject

The currently active document model is represented in the browser and does not document have this object in Android and IOS environments, nor does it support DOM operations associated with it.

No historylocationnavigatorObject
    • historyThe history of the current page is saved and a forward and backward operation is Provided.
    • locationInformation about the current page URL is Logged.
    • navigatorThe information in the current browser is Logged.

These interfaces are related to the implementation of the browser itself, which controls the forward and backward of the page and obtains state Information. Although there is also the concept of "history" and "navigation" in Android and iOS, it is used for jumps between multiple administrative views. In other words, "forward", "back" in the browser will still be in the same tab, in the native app "forward", "back" will actually jump to other Pages.

In addition Weex also provides a navigator module to operate the page jump, using the method reference "navigator navigation control".

Ability to invoke native API for mobile devices

The ability to invoke the mobile device native API in Weex is implemented by registering and invoking Modules. Some of these modules are Weex built-in, such as clipboard, navigator, storage, and so On.

    • "clipboard Shear plate"
    • "navigator Navigation control"
    • "storage Local storage"

In order to maintain the versatility of the framework, the Weex built-in native modules are limited, but Weex provides scale-out capabilities to extend native modules, and for specific extension methods, refer to IOS extensions and Android extensions.

Some interfaces also exist in the browser environment, but should be aware of browser compatibility when used, such as clipboard features, for security reasons, Most browsers restrict their use

Weex and Web Platform differences

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.