Desktop HTML viewer fail with 2020 R1

Anyone else seeing previously stable desktop code using HTMLViewer control failing in 2020 R1?

It’s a new browser engine!
WebKit 1.x vs 2.x

You need to adjust your code.

Failing in what way?

Wha tis failing, i’ve tested it to be working nicely

He probably has some code using older plugin classes with HTMLViewer or expects a specific JavaScript behavior.

1 Like

The problem I had was that my HTMLViewer could no longer load local images. Fortunately that nice Mr Rowlands worked up a method for me with some Declares in it to extract permission from macOS to do that. Have to do that now whenever doing a .LoadPage .

1 Like

No classes and no javascript. Nothing but simply Load locally stored html file; or html passed as a string.

Just using HTMLViewer as way to show information to user. Was easier to create HTML and display to the user than trying to wrangle RTF, or worse, hard-code it.

Thanks for reply, I decided not to run at it yet, and am sticking with latest 2019 for now. When I sort it out I’ll post here exactly what was (under 2019) is not working under 2020.

I’m loading local html too, but no images. Will look into your solution though!

Thanks Tim.

If you want to use javascript etc, you need a basic html template (DOM) otherwise there is nothing to change, configure or execute (in javascript).

So you could have:
<!doctype html>

And load that by string or via html file.
It should work with javascript. Also on macos you’d need some plist entries and you need the html file (and assets) inside a readable folder (temp or so)

Thanks for the reply. I’m only using basic HTML + CSS, very simple markup, no JS, no clever CSS hacks or tricks.

The problem is more defined now: flickering vertical HTMLViewer scrollbar and thus unable to scroll content.

Confirmed that pages are not continuously reloading.

Mac or windows ?
Did you set the renderer to “WebKit” ?

This thread is in the macOS channel so I would assume macOS

MacOS, and can confirm Renderer is “Native”

can you show a basic html structure you are trying to load, so we can try to see if it’s working?

Thanks for all your help. Appears that the root problem is that HTMLViewer handles URLs differently in '20. Apparently, now (vs '19) HTMLViewer (or its backend) validates the URLs in an html page before firing CancelLoad event in code. Thus, a URL (in my case to a local file) that does not (yet) exist never becomes a URL in the HTMLViewer. Tough on dynamic content creation and display. Create an HTML page (local disk storage, in say, Application Support. Include a link for a local file that does not exist. In '19 appears as a link and fires CancelLoad (in which one can create and/or modify contents based on user actions.) Not so in '20. Likely this is a security “feature” of some sort.

Solution I settled on to create a default empty html file, and then overwrite it as needed. Thus, file exists, and appears as valid URL in HTMLViewer, leading to CancelClose event in which I can modify that file as required.

Am I not understanding something here?

You don’t need that for LoadPage(HTMLstring, folderItemAnyFileBase) // html code directly from string
The second parameter can be any valid file somewhere in a reachable folder used as base to find resources around, like images, without paths. It just needs to exist.

Thanks for the lead. Point is, my prior version worked fine in 2019R3.x, and failed under 2020R1, so something changed in how the HTMLViewer operates, and that appears as I wrote above. I’ll think about your idea Rick, and am loath to yet again tear apart good working code in the name of progress.

Here’s another one … HTMLViewer 2019RX would open a file without a file extension, for example a temp file. R20 won’t, so more code changes.

The Release Notes for 2020r1 says:

Updated HTMLViewer on macOS to use WKWebView.