#hs.webview.usercontent
This module provides support for injecting custom JavaScript user content into your webviews and for JavaScript to post messages back to Hammerspoon.
#API Overview
Constructors - API calls which return an object, typically one that offers API methods
Methods - API calls which can only be made on an object returned by a constructor
#API Documentation
#Constructors
#Methods
| | | | --------------------------------------------|-------------------------------------------------------------------------------------| | Signature | hs.webview.usercontent:injectScript(scriptTable) -> usercontentControllerObject
| | Type | Method | | Description | Add a script to be injected into webviews which use this user content controller. | | Parameters |
- scriptTable - a table containing the following keys which define the script and how it is to be injected: source - the javascript which is injected (required) mainFrame - a boolean value which indicates whether this script is only injected for the main webview frame (true) or for all frames within the webview (false). Defaults to true. injectionTime - a string which indicates whether the script is injected at "documentStart" or "documentEnd". Defaults to "documentStart".
- the usercontentControllerObject or nil if the script table was malformed in some way.