Represents a frame in a web page More...
Import Statement: | import com.canonical.Oxide 1.15 |
Instantiates: | OxideQQuickWebFrame |
WebFrame represents a frame in a web page. It provides a way to access the currently committed URL (via url) as well as a mechanism to communicate with user scripts that the application has injected (via WebContext::userScripts).
childFrames : list<WebFrame> |
A list of WebFrames that are children of this frame.
messageHandlers : list<ScriptMessageHandler> |
The list of script message handlers attached to this frame. These can handle messages from user scripts injected in to this frame.
parentFrame : WebFrame |
The WebFrame that this frame is a child of. This remains constant for the life of the frame.
url : url |
The URL of the document that is currently displayed in this frame.
void addMessageHandler(ScriptMessageHandler handler) |
Add handler to the list of script message handlers attached to this frame. If handler is already attached to another WebView or WebFrame, then this will return without making any changes.
If handler is already attached to this frame then it will be moved to the end of the list.
This frame will assume ownership of handle by setting itself as the parent.
If handle is deleted whilst it is attached to this frame, then it will automatically be detached.
void removeMessageHandler(ScriptMessageHandler handler) |
Remove handler from the list of script message handlers attached to this frame.
This will unparent handler, giving ownership of it back to the application.
ScriptMessageRequest sendMessage(url context, string msgId, variant payload) |
Send a message to the handler for msgId provided by the user script injected in to the JS context identified by context. The message payload is supplied via {payload}. payload must be a value, object or array that can be represented by JSON values.
This returns a ScriptMessageRequest instance which is owned by the application and can be used to listen for a response.
Send a message to the handler for msgId provided by the user script injected in to the JS context identified by context. The message payload is supplied via {payload}. payload must be a value, object or array that can be represented by JSON values.