Commit 4b5029e2 authored by Leena Miettinen's avatar Leena Miettinen
Browse files

Doc: Add example code for using Greasemonkey attributes in scripts


Task-number: QTBUG-61788
Change-Id: Ie6c29f3999ea795a37ea444f56e40ddc70ca1c03
Reviewed-by: default avatarKai Koehne <kai.koehne@qt.io>
Showing with 33 additions and 2 deletions
......@@ -136,3 +136,13 @@
\externalpage https://http2.akamai.com/demo
\title Akamai HTTP/2 Demo
*/
/*!
\externalpage https://www.chromium.org/developers/design-documents/user-scripts
\title User Scripts
*/
/*!
\externalpage https://wiki.greasespot.net/Metadata_Block#.40name
\title Metadata Block
*/
......@@ -181,8 +181,29 @@
script to run, the injection point, and the world where the script is run. This enables
accessing the DOM to manipulate it within a world.
The following \l Greasemonkey attributes are supported since Qt 5.8:
\c @exclude, \c @include, \c @name, \c @match, and \c @run-at.
Since Qt 5.8, Qt WebEngine supports augmenting a script by using the
following \l{Metadata Block}{Greasemonkey-like attributes}:
\list
\li \c {@exclude <regexp>}
\li \c {@include <regexp>}
\li \c {@match <regexp>}
\li \c {@name <free text>}
\li \c {@run-at [document-start|document-end|document-idle]}
\endlist
The attributes determine if and when a \l {User Scripts}{user script} is
run. They must be placed immediately in the beginning of the script, inside
a \c ==UserScript== comment:
\code
// ==UserScript==
// @include http://*.qt.io/*
// @exclude http://wiki.qt.io/*
// ==/UserScript==
window.alert("Page is from qt.io, but not wiki.qt.io");
\endcode
\section1 Managing Certificates
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment