# MBS webviewer w/ js

**URL:** <https://the.fmsoup.org/t/mbs-webviewer-w-js/4999>\
**Category:** Floating Topics\
**Tags:** mbs\
**Created:** [August 15, 2025, 7:02pm UTC](https://the.fmsoup.org/t/mbs-webviewer-w-js/4999 "2025-08-15T19:02:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ccbamatx](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@ccbamatx](https://the.fmsoup.org/u/ccbamatx)\
**Post date:** [August 15, 2025, 7:02pm UTC](https://the.fmsoup.org/t/mbs-webviewer-w-js/4999/1 "2025-08-15T19:02:18Z")

</div>

With a webviewer I have named wvSOS, I am using the following:

MBS("WebView.Evaluate"; "wvSOS";

"document.querySelector('table')"

)

AND

MBS("WebView.Evaluate"; "wvSOS";

"new DOMParser().parseFromString( document.documentElement.outerHTML, 'text/html').querySelector('table')"

)

…. i get a [MBS] Windows error: -2147352319

Environment is FM Pro 17 and MBS 15.2.0.09

Ideas?

---

<div class="post-metadata">

**Author:** ![MonkeybreadSoftware](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/monkeybreadsoftware/32/361_2.png) [@MonkeybreadSoftware](https://the.fmsoup.org/u/MonkeybreadSoftware)\
**Post date:** [August 15, 2025, 7:30pm UTC](https://the.fmsoup.org/t/mbs-webviewer-w-js/4999/2 "2025-08-15T19:30:21Z")

</div>

How about using MBS("Trace") to log this?

Also with FM 17 you use IE, so you can only use functions, that exists in the old IE engine.

---

<div class="post-metadata">

**Author:** ![ccbamatx](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@ccbamatx](https://the.fmsoup.org/u/ccbamatx)\
**Post date:** [August 15, 2025, 8:01pm UTC](https://the.fmsoup.org/t/mbs-webviewer-w-js/4999/3 "2025-08-15T20:01:17Z")

</div>

This is the trace…..

Result #7: "OK"

MBS Plugin call #8 with 2 parameters.  
Parameter 0 FunctionName: "WebView.GetHTMLText"  
Parameter 1 WebViewerRef: "wvSOS"  
Result #8: "DIRECT ACCESS SUBSCRIBER LOGIN

\<LINK rel=stylesheet t..." (13831 characters)

MBS Plugin call #9 with 3 parameters.  
Parameter 0 FunctionName: "WebView.Evaluate"  
Parameter 1 WebViewerRef: "wvSOS"  
Parameter 2 Expression: "new DOMParser().parseFromString( document.documentElement.outerHTML, 'text/html').querySelector('table')"  
Result #9: "[MBS] Windows error: -2147352319"

MBS Plugin call #10 with 3 parameters.  
Parameter 0 FunctionName: "WebView.Evaluate"  
Parameter 1 WebViewerRef: "wvSOS"  
Parameter 2 Expression: "document.querySelector('table')"  
Result #10: "[MBS] Windows error: -2147352319"

MBS Plugin call #11 with 1 parameter.  
Parameter 0 FunctionName: "Version"  
Result #11: "15.2.0.09"

---

<div class="post-metadata">

**Author:** ![ccbamatx](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@ccbamatx](https://the.fmsoup.org/u/ccbamatx)\
**Post date:** [August 15, 2025, 8:06pm UTC](https://the.fmsoup.org/t/mbs-webviewer-w-js/4999/4 "2025-08-15T20:06:19Z")

</div>

Which MBS functions let me use js against the contents of webviewer in the old IE?

---

<div class="post-metadata">

**Author:** ![MonkeybreadSoftware](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/monkeybreadsoftware/32/361_2.png) [@MonkeybreadSoftware](https://the.fmsoup.org/u/MonkeybreadSoftware)\
**Post date:** [August 15, 2025, 9:12pm UTC](https://the.fmsoup.org/t/mbs-webviewer-w-js/4999/5 "2025-08-15T21:12:41Z")

</div>

Well, you could start with little things and go step by step.  
e.g. do MBS("WebView.Evaluate"; "wvSOS"; "1+2") to see if it works and returns 3.

document.querySelector returnes a NodeList, so check some details.

MBS("WebView.Evaluate"; "wvSOS"; "document.querySelector('table').length")

maybe that works? You can't return the node list directly.

---

<div class="post-metadata">

**Author:** ![ccbamatx](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@ccbamatx](https://the.fmsoup.org/u/ccbamatx)\
**Post date:** [August 15, 2025, 9:18pm UTC](https://the.fmsoup.org/t/mbs-webviewer-w-js/4999/6 "2025-08-15T21:18:18Z")

</div>

"var table = document.querySelector ? document.querySelector('table') : (document.getElementsByTagName('table')[0] || null);table" sets $r to [OBJECT].

document.querySelector ? document.querySelector('table') : (document.getElementsByTagName('table')[0] || null) does the same thing.

how do I look at [OBJECT]?

---

<div class="post-metadata">

**Author:** ![ccbamatx](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@ccbamatx](https://the.fmsoup.org/u/ccbamatx)\
**Post date:** [August 15, 2025, 9:18pm UTC](https://the.fmsoup.org/t/mbs-webviewer-w-js/4999/7 "2025-08-15T21:18:43Z")

</div>

…the 1+2 works just fine.

---

<div class="post-metadata">

**Author:** ![MonkeybreadSoftware](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/monkeybreadsoftware/32/361_2.png) [@MonkeybreadSoftware](https://the.fmsoup.org/u/MonkeybreadSoftware)\
**Post date:** [August 15, 2025, 9:29pm UTC](https://the.fmsoup.org/t/mbs-webviewer-w-js/4999/8 "2025-08-15T21:29:38Z")

</div>

You can't look on [OBJECT]. You need to have it return values.  
Maybe encode stuff as JSON if that works in IE.
