1# Class (WebContextMenuParam) 2 3Implements a **WebContextMenuParam** object, which is displayed after the user clicks the right mouse button or long presses a specific element, such as an image or a link. For details about the sample code, see [onContextMenuShow](./arkts-basic-components-web-events.md#oncontextmenushow9). 4 5> **NOTE** 6> 7> - The initial APIs of this component are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. 8> 9> - The initial APIs of this class are supported since API version 9. 10> 11> - You can preview how this component looks on a real device, but not in DevEco Studio Previewer. 12 13## constructor<sup>9+</sup> 14 15constructor() 16 17Constructs a **WebContextMenuParam** object. 18 19**System capability**: SystemCapability.Web.Webview.Core 20 21## x<sup>9+</sup> 22 23x(): number 24 25Obtains the X coordinate of the context menu. 26 27**System capability**: SystemCapability.Web.Webview.Core 28 29**Return value** 30 31| Type | Description | 32| ------ | ------------------ | 33| number | If the display is normal, a non-negative integer is returned. Otherwise, **-1** is returned.<br>Unit: vp.| 34 35## y<sup>9+</sup> 36 37y(): number 38 39Obtains the Y coordinate of the context menu. 40 41**System capability**: SystemCapability.Web.Webview.Core 42 43**Return value** 44 45| Type | Description | 46| ------ | ------------------ | 47| number | If the display is normal, a non-negative integer is returned. Otherwise, **-1** is returned.<br>Unit: vp.| 48 49## getLinkUrl<sup>9+</sup> 50 51getLinkUrl(): string 52 53Obtains the URL of the link. 54 55**System capability**: SystemCapability.Web.Webview.Core 56 57**Return value** 58 59| Type | Description | 60| ------ | ------------------------- | 61| string | If it is a link that is being long pressed, the URL that has passed the security check is returned.| 62 63## getUnfilteredLinkUrl<sup>9+</sup> 64 65getUnfilteredLinkUrl(): string 66 67Obtains the URL of the unfiltered link. 68 69**System capability**: SystemCapability.Web.Webview.Core 70 71**Return value** 72 73| Type | Description | 74| ------ | --------------------- | 75| string | If it is a link that is being long pressed, the original URL is returned.| 76 77## getSourceUrl<sup>9+</sup> 78 79getSourceUrl(): string 80 81Obtain the source URL. 82 83**System capability**: SystemCapability.Web.Webview.Core 84 85**Return value** 86 87| Type | Description | 88| ------ | ------------------------ | 89| string | If the selected element has the **src** attribute, the URL in the **src** is returned.| 90 91## existsImageContents<sup>9+</sup> 92 93existsImageContents(): boolean 94 95Checks whether image content exists. 96 97**System capability**: SystemCapability.Web.Webview.Core 98 99**Return value** 100 101| Type | Description | 102| ------- | ------------------------- | 103| boolean | The value **true** means that there is image content in the element being long pressed, and **false** means the opposite.| 104 105## getMediaType<sup>9+</sup> 106 107getMediaType(): ContextMenuMediaType 108 109Obtains the media type of this web page element. 110 111**System capability**: SystemCapability.Web.Webview.Core 112 113**Return value** 114 115| Type | Description | 116| ---------------------------------------- | --------- | 117| [ContextMenuMediaType](./arkts-basic-components-web-e.md#contextmenumediatype9) | Media type of the web page element.| 118 119## getSelectionText<sup>9+</sup> 120 121getSelectionText(): string 122 123Obtains the selected text. 124 125**System capability**: SystemCapability.Web.Webview.Core 126 127**Return value** 128 129| Type | Description | 130| ------ | -------------------- | 131| string | Selected text for the context menu. If no text is selected, null is returned.| 132 133## getSourceType<sup>9+</sup> 134 135getSourceType(): ContextMenuSourceType 136 137Obtains the event source of the context menu. 138 139**System capability**: SystemCapability.Web.Webview.Core 140 141**Return value** 142 143| Type | Description | 144| ---------------------------------------- | ------- | 145| [ContextMenuSourceType](./arkts-basic-components-web-e.md#contextmenusourcetype9) | Event source of the context menu.| 146 147## getInputFieldType<sup>9+</sup> 148 149getInputFieldType(): ContextMenuInputFieldType 150 151Obtains the input field type of this web page element. 152 153**System capability**: SystemCapability.Web.Webview.Core 154 155**Return value** 156 157| Type | Description | 158| ---------------------------------------- | ------ | 159| [ContextMenuInputFieldType](./arkts-basic-components-web-e.md#contextmenuinputfieldtype9) | Input field type.| 160 161## isEditable<sup>9+</sup> 162 163isEditable(): boolean 164 165Checks whether this web page element is editable. 166 167**System capability**: SystemCapability.Web.Webview.Core 168 169**Return value** 170 171| Type | Description | 172| ------- | -------------------------- | 173| boolean | **true** is returned if the web page element is editable; otherwise, **false** is returned.| 174 175## getEditStateFlags<sup>9+</sup> 176 177getEditStateFlags(): number 178 179Obtains the edit state flag of this web page element. 180 181**System capability**: SystemCapability.Web.Webview.Core 182 183**Return value** 184 185| Type | Description | 186| ------ | ---------------------------------------- | 187| number | Edit state flag of the web page element. For details, see [ContextMenuEditStateFlags](./arkts-basic-components-web-e.md#contextmenueditstateflags9).| 188 189## getPreviewWidth<sup>13+</sup> 190 191getPreviewWidth(): number 192 193Obtains the width of a preview image. 194 195**System capability**: SystemCapability.Web.Webview.Core 196 197**Return value** 198 199| Type | Description | 200| ------ | ----------- | 201| number | Width of a preview image.<br>Unit: vp.| 202 203## getPreviewHeight<sup>13+</sup> 204 205getPreviewHeight(): number 206 207Obtains the height of a preview image. 208 209**System capability**: SystemCapability.Web.Webview.Core 210 211**Return value** 212 213| Type | Description | 214| ------ | ---------- | 215| number | Height of a preview image.<br>Unit: vp.| 216