Posts

Post not yet marked as solved
7 Replies
The work-arounds above also work for VMware virtual machines (at least, those running High Sierrra and Safari 13), which otherwise silently abort attempts to enable either of the "Allow Javascript..." Develop Menu options at the point when they should prompt for a password. Note the above AppleScript can be enhanced to recognize that the option is already enabled. The improved version (which I also made a little more concise by using a reference) is below. tell application "System Events" tell application "Safari" to activate delay 1 tell process "Safari" -- check if developer menu is available set menuItems to name of every menu bar item of menu bar 1 if "Develop" is not in menuItems then error "You must enable developer menu" number -1024 -- get a reference to the "Allow" menu item set mitem to a reference to menu item "Allow JavaScript from Apple Events" of menu 1 of menu bar item "Develop" of menu bar 1 -- stop now if it's already enabled if (value of attribute "AXMenuItemMarkChar" of mitem) = "✓" then error "\"Allow JavaScript from Apple Events\" is already enabled" number -1024 -- click to allow js events click mitem -- confirm allow in the pop-up dialog box if value of static text 1 of window 1 is "Are you sure you want to allow JavaScript from Apple Events?" then click button "Allow" of window 1 end tell end tell