UserScript QML Type

A user script More...

Import Statement: import com.canonical.Oxide 1.15
Instantiates: OxideQQuickUserScript

Properties

Detailed Description

UserScript represents a single JS file to inject in to web pages. The location of the file is specified by url.

The way that the script is injected can be controlled by emulateGreasemonkey, matchAllFrames and incognitoEnabled. In addition to this, UserScript supports a limited subset of the Greasemonkey metadata (@include, @exclude, @match, @exclude_match and @run-at).

User scripts are not injected in to the same JS context as the web page's script - they are injected in to a unique execution environment that has access to the DOM but no access to functions or variables created by the page. Scripts can be injected in to different contexts, specified by context.

Property Documentation

context : url

An identifier for the javascript context in which to inject this user script.


emulateGreasemonkey : bool

Set to true to inject the script content in to its own scope. This is set to false by default.


incognitoEnabled : bool

Whether to inject the script in to frames that are inside an incognito webview. This is false by default, which means that this script will not be injected in to frames that are in an incognito webview.


matchAllFrames : bool

Whether to inject the script in to all frames. This is false by default, which means the script will only be injected in to the main frame.


url : url

The URL of the script to load. This can only be set during construction - attempts to change it afterwards will be ignored.

This can only be set to a local file: URL. Other URL schemes are not supported.