# Web Browser Click

**URL:** <https://forum.inductiveautomation.com/t/web-browser-click/77104>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [July 29, 2023, 8:04pm UTC](https://forum.inductiveautomation.com/t/web-browser-click/77104 "2023-07-29T20:04:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![pablo.turmero](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@pablo.turmero](https://forum.inductiveautomation.com/u/pablo.turmero)\
**Post date:** [July 29, 2023, 8:04pm UTC](https://forum.inductiveautomation.com/t/web-browser-click/77104/1 "2023-07-29T20:04:47Z")

</div>

Hi, guys. Is there a way to get a click or event from a small html/javascript page using the web browser and execute a script in vision? I can't find a way 😪

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [July 29, 2023, 8:23pm UTC](https://forum.inductiveautomation.com/t/web-browser-click/77104/2 "2023-07-29T20:23:10Z")

</div>

It would be a major security hazard if browsers could execute programs on a client OS. Browsers don't allow that.

Why don't you describe the real problem you're trying to solve rather than your solution?

---

<div class="post-metadata">

**Author:** ![pablo.turmero](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@pablo.turmero](https://forum.inductiveautomation.com/u/pablo.turmero)\
**Post date:** [July 29, 2023, 9:23pm UTC](https://forum.inductiveautomation.com/t/web-browser-click/77104/3 "2023-07-29T21:23:37Z")

</div>

I'm using the web browser component to draw a map with openstreetmap, and I want to run a script when I click on a marker. I know there is no problem doing it in perspective, but I need it from vision.

I appreciate the help.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [July 30, 2023, 2:57am UTC](https://forum.inductiveautomation.com/t/web-browser-click/77104/4 "2023-07-30T02:57:14Z")

</div>

You're wanting to execute javascript in the web browser component?  
It can be done in this way:

```auto
webComponent = event.source #or whatever your relative path is
webbrowser = webComponent.browser
frame = webbrowser.focusedFrame()
if frame.isPresent():
	frame.get().executeJavaScript("PUT YOUR JAVASCIPT AS A STRING HERE")
```

---

<div class="post-metadata">

**Author:** ![pablo.turmero](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@pablo.turmero](https://forum.inductiveautomation.com/u/pablo.turmero)\
**Post date:** [July 30, 2023, 9:05pm UTC](https://forum.inductiveautomation.com/t/web-browser-click/77104/5 "2023-07-30T21:05:39Z")

</div>

Hi!

I am trying to capture an event from the web browser to do something via script from vision later.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [July 30, 2023, 9:07pm UTC](https://forum.inductiveautomation.com/t/web-browser-click/77104/6 "2023-07-30T21:07:54Z")

</div>

> [@pablo.turmero](#):
>
> I am trying to capture an event from the web browser to do something via script from vision later.

We know. You've told us twice already.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 30, 2023, 11:15pm UTC](https://forum.inductiveautomation.com/t/web-browser-click/77104/7 "2023-07-30T23:15:09Z")

</div>

The way in which you listen to a click is by injecting custom JavaScript. You'll have to research how to create the appropriate listener and where to inject it on your own. Jxbrowser sets up certain hooks that would allow the page to send a message back to the constaining Java application; you're also going to have to look up how to do that.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [July 31, 2023, 12:16am UTC](https://forum.inductiveautomation.com/t/web-browser-click/77104/8 "2023-07-31T00:16:09Z")

</div>

Just about everything you would need to figure this out can be found in the [guides](https://jxbrowser-support.teamdev.com/docs/guides/) and [tutorials](https://jxbrowser-support.teamdev.com/docs/tutorials/) sections of the [jxBrowser documentation](https://jxbrowser-support.teamdev.com/docs/guides/introduction/requirements.html):

> **[JavaScript](https://jxbrowser-support.teamdev.com/docs/guides/javascript.html)**
>
> JxBrowser getting started, guides, tutorials, examples, release notes, roadmap, blog, etc.

> **[Listening to Content Changes](https://jxbrowser-support.teamdev.com/docs/tutorials/dom/listening.html)**
>
> JxBrowser getting started, guides, tutorials, examples, release notes, roadmap, blog, etc.

---

<div class="post-metadata">

**Author:** ![pablo.turmero](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@pablo.turmero](https://forum.inductiveautomation.com/u/pablo.turmero)\
**Post date:** [July 31, 2023, 1:49pm UTC](https://forum.inductiveautomation.com/t/web-browser-click/77104/9 "2023-07-31T13:49:31Z")

</div>

Thanks, I'll check it out.
