How to embedded apple script in a link in HTML?
The app is called LinCastor. (It can also be installed with homebrew cask if you have it.)

First click "add new scheme" in the bottom left of the main window, then change the title to whatever you like and the "scheme(s)" to x-applescript-runner.

Change the "handler" below from AppleScript to Shell, and paste this code in:

#!/usr/bin/env python

THE_PASSWORD = 'secret'

import os
import urlparse
import subprocess

params = urlparse.parse_qs(os.environ["URL_QUERY"].lstrip('?'))

password = params['password'][0]
script = params['script'][0]

if password == THE_PASSWORD:
    subprocess.call(['osascript', '-e', script])


Hit "Save and Activate", then test it with this url:

x-applescript-runner://?password=secret&amp;script=display%20dialog%20%22hello%22%0A


Obviously you'll want to change the password from secret to something better like V2VkIEZlYiAxMSAyMjo0MjozOSBFU1QgMjAxNQo= (but not that either!). The password should make it slightly more secure, but of course anyone who sees your URL will still be able to run whatever they want with a URL.