HTMLViewer Reload

On Mac/desktop, right-clicking (control-clicking) on an HTMLViewer shows the “Reload” context menu. Can it be disabled somehow? thanks…

yes… You can either inject JavaScript to disable it, or you can use declares… Pick and I shall deliver…

Sorry, I forgot I put my HTMLViewer subclass up on GitHub… This adds some extra functionality to the WebKit viewer (does not allow for “native” renderer)… Most of the new goodies are for Mac OS X only as I need time to sit down with the other OSes and add the features in…

https://github.com/shaosean-tk/WebKitViewer

thanks shao, can you post the js code?

In the open event :

me.ExecuteJavaScript("document.addEventListener(""contextmenu"", function(e){ e.preventDefault(); }, false);")

Extraordinary!

I suggest copy that line right after the “real” ExecuteJavaScript you are trying to use, instead the Open event.

[quote=133253:@Lisandro Mulena]Extraordinary!

I suggest copy that line right after the “real” ExecuteJavaScript you are trying to use, instead the Open event.[/quote]

Yes. DocumentComplete may be the place, since loading a page will break the code.

Great.
Or, in my case, I put it on a Method and then you can call it from whenever you want.
For example, in the change event of a TabPanel that contains the HTMLViewer.

thank you Michael for your help

Always do your injections in the DocumentComplete event that way it will always get injected…

[quote=133108:@shao sean]Sorry, I forgot I put my HTMLViewer subclass up on GitHub… This adds some extra functionality to the WebKit viewer (does not allow for “native” renderer)… Most of the new goodies are for Mac OS X only as I need time to sit down with the other OSes and add the features in…

https://github.com/shaosean-tk/WebKitViewer[/quote]

@shao sean
You have a Method ‘DisableDrop’ in WebKitViewer, unfortunately it does not work.

me.ExecuteJavaScript "document.addEventListener('dragover', function(event){event.preventDefault();}, false);" me.ExecuteJavaScript "document.addEventListener('dragenter', function(event){event.preventDefault();}, false);" me.ExecuteJavaScript "document.addEventListener('drop', function(event){event.preventDefault();}, false);"

not working in Safari, maybe that’s the problem