Version: 3.0.0

WebView

<Webview> on lumin

Description

WebView renders HTML, CSS, and JavaScript content in a prism. When you enable web inspectors in your app, use web inspector clients, such as Chrome DevTools, to debug the displayed WebView content.

Example

⚠️ Don't forget to include the WebView and Internet privileges in your manifest.xml file!
<uses-privilege ml:name="WebView"/>
<uses-privilege ml:name="Internet"/>
import React from "react";
import { View, WebView, Prism, Scene } from "magic-script-components";
export class ExampleWebView extends React.Component {
render() {
return (
<Scene>
<Prism size={[1, 1, 0.2]} >
<View name="main-view" alignment={'center-center'}>
<WebView width={1} height={0.8} url={'https://www.magicleap.com'} />
</View>
</Prism>
</Scene>
);
}
}

Common Events

Common Properties

Create Properties

NameTypeDefault ValueRequiredDescription
widthnumbern/aYThe width of the WebView. Must be greater than 0
heightnumbern/aYThe height of the WebView. Must be greater than 0

Element Properties

NameTypeDefault ValueDescription
urlstringn/aSets the URL to load in the WebView.
actionstringn/aRequests the specified action.
scrollByvec2n/aScrolls the WebView in the given direction. Enter an array of two numbers: [xPixels, yPixels]

action options: WebViewAction