目录

How do I adapt ArkWeb to multiple devices?

During web page development, use the @media query in the CSS, and set different styles based on different screen sizes. You can refer to Responsive Web Design (RWD), such as the percentage unit and viewport unit. In addition, you can use a mature frontend framework, in which components can adapt to multiple devices. For details, please refer to Responsive Layout on Web.

If the third-party web page has used the UA to adapt to the mobile device but the effect is incorrect on the HarmonyOS device, the possible cause is that the UA of the HarmonyOS device is not adapted. You can use getUserAgent() on the ArkTS side to view the UA of a HarmonyOS device for adaptation, or use setCustomUserAgent to define the UA.

Reference

Default User-Agent Structure

setCustomUserAgent