5 Replies
      Latest reply on Jun 21, 2019 10:10 AM by iBerlioz
      Ballstone Level 1 Level 1 (0 points)

        On 10.12.6, selecting Allow Javascript from Apple Events from the Develop menu does not stick.

        Steps to reproduce-

         

        1. Develop menu > Allow Javascript from Apple Events
        2. Click "Allow" in the dialog box.

        Result: Develop menu shows the setting UNchecked.


        Tested with defaults read shows it is enabled (1).

        Writing defaults completes without error.

        Tested in different user account.

        Tested with Safari beta 11.1.1, and Technology Preview

        • Re: Allow Javascript from Apple Events will not activate
          jgobble Level 1 Level 1 (0 points)

          I have this issue too... (Running 10.13.5)

          ps: "defaults write -app Safari AllowJavaScriptFromAppleEvents 1" does not help!

           

          Any solutions out there?

          • Re: Allow Javascript from Apple Events will not activate
            scannermonkey Level 1 Level 1 (0 points)

            I found the solution on Github

             

            step 1 enable virtual keyboard for controls

            If you haven't already, you'll need to open System Preferences > Keyboard > Shortcuts and change the Full Keyboard Access setting to All controls.

             

            step 2 with virtual keyboard fully enabled

            Select the "Allow JavaScript from Apple Events" from Develop menu option in Safari as normal.

            When You get the prompt "Are you sure you want to allow JavaScript from Apple Events?" don't click "Allow" with mouse, but press space bar (press this button by keyboard) and then a magic window asking for a password will appear.

              • Re: Allow Javascript from Apple Events will not activate
                Peter in Japan Level 1 Level 1 (0 points)

                Thank you! You saved my bacon!

                • Re: Allow Javascript from Apple Events will not activate
                  StarPlayr Level 1 Level 1 (0 points)

                  The virtual keyboard thing did not work for me. Then I realised I was accessing our file server third Remote Desktop and directly on the computer. Plugging in a keyboard and mouse to the Server allowed my to turn on JavaScript Apple Events in Safari and set the password.

                   

                  However, you can't always do this, so the next best thing is use an accessbility scripting feature and have the machine think a user is doing the clicks, allowing you to set the password:

                   

                  -- The delays can be shorter, coordinates may vary

                  -- Best way to get the coordinates is with Apple screen capture (command-shift-4) from upper right to lower left

                  -- if one spends the time, the click events can be converted to Accessibility AppleScript objects by capturing them as variables, or checking the events and using the events instead of the click coordinates

                   

                  tell application "System Events"

                   

                    tell application "Safari"

                         activate

                    end tell

                   

                    delay 1

                     

                  -- click develop menu (make sure its on first)

                    click at {430, 12}

                   

                    delay 1

                   

                  -- click Allow Javascript menu from Apple Events

                    click at {615, 615}

                   

                    delay 1

                     

                  -- Click the Allow Button

                    click at {1010, 386}

                  end tell