WebEngineScriptCollection QML Type | Qt WebEngine (original) (raw)

Manages a collection of user scripts. More...

Import Statement: import QtWebEngine
Since: QtWebEngine 6.2

Properties

Methods

Detailed Description

WebEngineScriptCollection handles a user scripts collection, which is injected in the JavaScript engine during the loading of web content.

Use WebEgineView.userScripts and WebEngineProfile.userScripts to access the collection of scripts associated with a single page or number of pages sharing the same profile.

The collection of user script objects in QML can be created for a set of user script objects by simple assignment to WebEngineScriptCollection.collection property or by WebEngineScriptCollection methods.

Note: The new user script can be instantiated with JavaScript dictionaries when using collection property.

See the following code snippets demonstrating the usage:

webEngineView.userScripts.collection = [ scriptFoo, scriptBar ];

See also WebEngineScript and WebEngineScriptCollection.

Property Documentation

This property holds a JavaScript array of user script objects. The array can take WebEngineScript basic type or a JavaScript dictionary as values.

This property was introduced in QtWebEngine 6.2.

Method Documentation

[since QtWebEngine 6.2] void clear()

Removes all script objects from this collection.

This method was introduced in QtWebEngine 6.2.

Returns true if the specified script is in the collection, false otherwise.

This method was introduced in QtWebEngine 6.2.

See also find().

Returns a list of all user script objects with the given name.

This method was introduced in QtWebEngine 6.2.

See also contains().

Inserts a single script into the collection.

This method was introduced in QtWebEngine 6.2.

See also remove().

Inserts a list of WebEngineScript values into the user script collection.

This method was introduced in QtWebEngine 6.2.

See also remove().

Returns true if a given script is removed from the collection.

This method was introduced in QtWebEngine 6.2.

See also insert().

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.