Issues with page's Javascript not executing in HTMLViewer on Mac

On OS X 10.11.5, Xojo 2016r2.

I can’t seem to get Javascript alert() or window.location.href to work in HTMLViewer on Mac (it’s working fine on Windows). The page source I’m loading is simply:

<a href="" onclick="alert('asef'); return false;">12345</a>

The “return false;” is working in that it does not continue to the link. However alerts, and changing the window.location.href aren’t doing anything on Mac for me. Javascript seems to be enabled when testing with .

I don’t think alert() has ever automatically produced a result on Mac for me.
What exactly are you trying to do? Working with HTML Viewer can be tricky sometimes, and we have workarounds for a lot of things.

I was just using alert as a test so that’s less important, but I’m trying to get window.location.href working so I can control the HTMLViewer’s visible page.

I would be controlling some things via the CancelLoad event in the HTMLViewer so I’d like to be able to use window.location.href through various Javascript elements to do so.

Are you trying to intercept data or pageloads with CancelLoad?
The usual workaround for sending data out of the HTML Viewer to Xojo is to use Window.Status and use the StatusChanged event.

I think I figured it out, two separate “issues”.

  1. The links have to begin with “http://” on Mac even if loaded from Javascript within the HTMLViewer (which is mentioned in the docs under the LoadURL method). I was getting confused here because it was working fine in Safari.
  2. The alert() just does nothing in the HTMLViewer (which is fine).

You can use WebUIDelegateMBS to implement events so that JavaScript can show dialogs

http://monkeybreadsoftware.net/class-webuidelegatembs.shtml

[quote=278506:@Tim Parnell]Are you trying to intercept data or pageloads with CancelLoad?
The usual workaround for sending data out of the HTML Viewer to Xojo is to use Window.Status and use the StatusChanged event.[/quote]

Thanks for the help, Tim. I’m probably going to be using a combination of using CancelLoad and StatusChanged for this.