Blocking JavaScript in HtmlViewer

Hello,
one of my desktop apps uses an HtmlViewer to display some web content and it would be useful if the user could disable the execution of JavaScript. Is it possible to block/disable Javascript in an HtmlViewer? For example in Safari one can enable/disable JavaScript in Preferences->Security. I did not find such an option in the Xojo documentation for the HtmlViewer.

We have a handy WebPreferencesMBS class with a switch for that in our MBS Plugins:

http://www.monkeybreadsoftware.net/class-webpreferencesmbs.shtml

Thanks. I’ll take a look into it.

In the opposite direction, does WebPreferencesMBS.javaScriptCanOpenWindowsAutomatically mean that a link inside an HTMLViewer allow things like opening your email application with a mailto: link?

You can block it there.

If you don’t block them, you still need to write code to open the new window if you want to support links for opening popups.

Christian, does this class work for Windows or just for Mac? I didn’t see a reference for this under Windows in the Documentation.

WebPreferencesMBS is Mac only.

Preventing the execution of JavaScript is a user preference. It should not be messed with gratuitously.

From what I understand, WebPreferencesMBS modifies the user preferences for all browsers. So just imagine I run your program, and I need to use my browser at a the same time, I will be unable to execute JavaScript.

Likewise, when you quit your program, you must restore the preferences.

For all?
No, it should be local to your app.
You can even have preferences per web viewer.

Then that is fine;