Disable JavaScript

Mac OSX specific forum
wombats
Enthusiast
Enthusiast
Posts: 716
Joined: Thu Dec 29, 2011 5:03 pm

Disable JavaScript

Post by wombats »

Hi,

I'm using a popup menu on a WebViewGadget to provide a context menu. The problem is, when the menu is open, the WebViewGadget still responds to the mouse moving, etc., causing issues. I tried DisableGadget, but it didn't work. Is it possible to temporarily disable JavaScript while the menu is open? I imagine I'd then need a way to detect when the menu closes.

I found this: https://developer.apple.com/documentati ... references, but I don't really know how to access it using CocoaMessage.
wombats
Enthusiast
Enthusiast
Posts: 716
Joined: Thu Dec 29, 2011 5:03 pm

Re: Disable JavaScript

Post by wombats »

I figured it out:

Code: Select all

webview = CocoaMessage(0, GadgetID(0), "contentView")
config = CocoaMessage(0, webview, "configuration")
preferences = CocoaMessage(0, config, "preferences")
CocoaMessage(0, preferences, "setJavaScriptEnabled:", #False)
Post Reply