# HTMLViewer: Xojo + JavaScript Communication

**URL:** <https://forum.xojo.com/t/htmlviewer-xojo-javascript-communication/56767>\
**Category:** Windows\
**Created:** [September 5, 2020, 11:53pm UTC](https://forum.xojo.com/t/htmlviewer-xojo-javascript-communication/56767 "2020-09-05T23:53:10Z")\
**Posts on this page:** 6\
**Page:** 4

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [September 7, 2020, 12:26pm UTC](https://forum.xojo.com/t/htmlviewer-xojo-javascript-communication/56767/61 "2020-09-07T12:26:13Z")

</div>

If you happen to have the MBS plugins:

in the open event of the htmlviewer you could do:

```
Me.WKWebViewMBS.developerExtrasEnabled = True

```

It will add the option “Inspect” to the context menu and you can debug your html (and asset) loading.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [September 7, 2020, 12:58pm UTC](https://forum.xojo.com/t/htmlviewer-xojo-javascript-communication/56767/62 "2020-09-07T12:58:39Z")

</div>

OK, back from lunch now.

1. Checking my code, f is in fact a folderitem for the first of the images contained in the html, or Nil if there are none. Sorry for this mis-information.

2. The html in question is not a website but the body of an email, so there is no URL. The images are sent separately from the html content, but are still in the same email. The Content-Id: header makes the link between the image and where it is referred to in the html, so I have to replace this on the fly with a URL, which for a local file takes the form I gave upthread.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [September 7, 2020, 1:06pm UTC](https://forum.xojo.com/t/htmlviewer-xojo-javascript-communication/56767/63 "2020-09-07T13:06:40Z")

</div>

> [@Rick\_Araujo](#):
>
> **Any protocol other than HTTP may or may not work** as that is dependent on operating system behavior.

In the example I posted, it is a static HTML page I use for my apps manual. So I control which protocol is used. It can be https:// in iOS since Apple now requires it, but the principle remains the same.

Reading Tim’s last post, it is apparent he has to do some dynamic code replacement which indeed would not be possible (or simple) with loadURL.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [September 7, 2020, 1:24pm UTC](https://forum.xojo.com/t/htmlviewer-xojo-javascript-communication/56767/64 "2020-09-07T13:24:58Z")

</div>

Far as I can tell from testing, CancelLoad doesn’t happen at all with Webkit as a .LoadPage takes place. I do have a handler for that event, which returns if “about:blank” and one or two others, show up.

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [September 7, 2020, 4:53pm UTC](https://forum.xojo.com/t/htmlviewer-xojo-javascript-communication/56767/65 "2020-09-07T16:53:18Z")

</div>

It looks like I’m using URLPath and it works.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:40pm UTC](https://forum.xojo.com/t/htmlviewer-xojo-javascript-communication/56767/66 "2021-04-29T16:40:07Z")

</div>



[Previous page](https://forum.xojo.com/t/htmlviewer-xojo-javascript-communication/56767.md?page=3)
