Edit in GitHubLog an issue

window.HTMLWebViewElement

Properties

NameTypeDescription
uxpallowinspectorbooleanEnable Developer tools for WebView
e.g., <webview src="https://www.adobe.com" uxpallowinspector="true"></webview>

src : string

The url of the webview

dataset

Access to all the custom data attributes (data-*) set.

See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset

innerText : string

lang : string

nodeName : string

Read only

localName : string

Read only

tagName : string

Read only

nodeType : number

Read only

namespaceURI : string

Read only

id : string

tabIndex : number

className : string

attributes : NamedNodeMap

Read only

style : Style

Read only

clientLeft : number

Read only

clientTop : number

Read only

clientWidth : number

Read only

clientHeight : number

Read only

height : string | Number

The height of the element

width : string | Number

The width of the element

offsetParent : Element

Read only

offsetLeft : number

Read only

offsetTop : number

Read only

offsetWidth : number

Read only

offsetHeight : number

Read only

scrollLeft : number

scrollTop : number

scrollWidth : number

Read only

scrollHeight : number

Read only

autofocus : boolean

Indicates if the element will focus automatically when it is loaded

uxpContainer : number

Read only

disabled : boolean

innerHTML : string

outerHTML : string

contentEditable

Read only

isConnected : boolean

Read only

parentNode : Node

Read only

parentElement : Element

Read only

firstChild : Node

Read only

lastChild : Node

Read only

previousSibling : Node

Read only

nextSibling : Node

Read only

firstElementChild : Node

Read only

lastElementChild : Node

Read only

previousElementSibling : Node

Read only

nextElementSibling : Node

Read only

textContent : string

childNodes : NodeList

Read only

children : HTMLCollection

Read only

ownerDocument

Read only

postMessage(message, targetOrigin, transfer)

Post a message to the content in the webview. Note that the content in the webview can also post a message to plugin via window.uxpHost.postMessage(msg). The message sent to HTMLWebViewElement is also stringified & parsed by JSON. Plugin can receive the messages from WebView via 'message' event.

[Plugin]

  • send messages to the content in the WebView HTMLWebViewElement.postMessage(msg)
  • receive messages from the content in the WebView window.addEventListener("message", (e) => { ... }) where e: Event { origin: URL of the content, source: window.uxpHost, data: message }

[Content in the WebView]

  • send messages to plugin window.uxpHost.postMessage(message)
  • receive messages from plugin window.addEventListener("message", (e) => { ... }) where e: Event { origin: plugin id, source: WebView element, data: message }
ParamTypeDescription
messageObjectA message sent to the webview. Please note that the message is stringified & parsed by JSON
targetOriginStringThe origin of webview for the event to be dispatched. The literal string "*" indicates no preference
transferObjectNot supported yet.

scrollTo(xOrOptions, y)

Scrolls the element to the new x and y positions. If options object is used with behavior: "smooth" then the element is smoothly scrolled.

See: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo

ParamTypeDescription
xOrOptions*either the new scrollLeft position or an options object.
y*the optional new scrollTop position.

scrollIntoView(alignToTop)

ParamType
alignToTopboolean

scrollIntoViewIfNeeded()

focus()

blur()

getAttribute(name)

Returns: string

ParamType
namestring

setAttribute(name, value)

ParamType
namestring
valuestring

removeAttribute(name)

ParamType
namestring

hasAttribute(name)

Returns: boolean

ParamType
namestring

getAttributeNode(name)

Returns: *

ParamType
namestring

setAttributeNode(newAttr)

ParamType
newAttr*

removeAttributeNode(oldAttr)

ParamType
oldAttr*

click()

getElementsByClassName(name)

Returns: NodeList

ParamType
namestring

getElementsByTagName(name)

Returns: NodeList

ParamType
namestring

querySelector(selector)

Returns: Element

ParamType
selectorstring

querySelectorAll(selector)

Returns: NodeList

ParamType
selectorstring

getBoundingClientRect()

Returns: *

closest(selectorString)

Returns: Element
See: https://developer.mozilla.org/en-US/docs/Web/API/Element/closest

ParamType
selectorStringstring

matches(selectorString)

Returns: boolean
See: https://developer.mozilla.org/en-US/docs/Web/API/Element/matches

ParamType
selectorStringstring

insertAdjacentHTML(position, value)

ParamType
position
valuestring

insertAdjacentElement(position, node)

Returns: Node

ParamType
position*
node*

insertAdjacentText(position, text)

ParamType
position*
text*

hasChildNodes()

Returns: boolean

cloneNode(deep)

Returns: Node

ParamType
deepboolean

appendChild(child)

Returns: Node

ParamType
childNode

insertBefore(child, before)

Returns: Node

ParamType
childNode
beforeNode

replaceChild(newChild, oldChild)

Returns: Node

ParamType
newChildNode
oldChildNode

removeChild(child)

Returns: Node

ParamType
childNode

remove()

before(...nodes)

ParamType
...nodesArray<Node>

after(...nodes)

ParamType
...nodesArray<Node>

replaceWith(...nodes)

ParamType
...nodesArray<Node>

contains(node)

ParamType
nodeNode

addEventListener(eventName, callback, [capture])

ParamTypeDefault
eventName*
callback*
[capture]booleanfalse

removeEventListener(eventName, callback, [capture])

ParamTypeDefault
eventName*
callback*
[capture]booleanfalse

dispatchEvent(event)

ParamType
event*
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2023 Adobe. All rights reserved.