Question: Hello I was wondering is there a way for me to click a link with button but i want to click the link based on an input value? 

Sorry for bad English

```js
function clicklink() {
    document.getElementsByClassName("hud-link")[0].click();
}
```

```html
<div class="hud">
    <a class="hud-link" href="https://stackoverflow.com">Link Here 1</a>
</div>
<br>
<div class="hud">
    <a class="hud-link" href="https://google.com">Link Here 2</a>
</div>
<br>
<div class="hud">
    <a class="hud-link" href="https://yahoo.com">Link Here 3</a>
</div>
<br>
<div class="hud">
    <a class="hud-link" href="https://bing.com">Link Here 4</a>
</div>
<br>
<input type="number" min="0" max="4" value="0">

<button onclick="clicklink();">Click Link</button>
```

Answer: 
There is not a generic context key for when a webview is active. However using the `setContext` command, you can create a custom context that tracks just when one of your webviews is active 

Here's what VS code's markdown preview (which also uses a webview) does to create a custom context key that is set when the preview is active:

<https://github.com/Microsoft/vscode/blob/cd7c7c5fa2c16c6e8281436c35e9a7709cfbd89d/extensions/markdown-language-features/src/features/previewManager.ts#L152>
I believe this new context value is what you need:

#### New activeWebviewPanelId context key

The new `activeWebviewPanelId` context key tracks the `viewType` of the currently focused webview panel. You can use it in when clauses to enable commands or menu items when your webview is focused

```
"when": "activeWebviewPanelId == 'markdown.preview'"

```

from [v1.71 Release Notes: active webview panel context key](https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_71.md#new-activewebviewpanelid-context-key)