Class WebPage

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public final class WebPage extends GObject
A loaded web page.
  • Constructor Details

    • WebPage

      public WebPage(MemorySegment address)
      Create a WebPage instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • WebPage

      public WebPage()
      Create a new WebPage.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the WebPage class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected WebPage asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • getEditor

      public WebEditor getEditor()
      Gets the WebKitWebEditor of a WebKitWebPage.
      Returns:
      the WebKitWebEditor
      Since:
      2.10
    • getFormManager

      public WebFormManager getFormManager(@Nullable ScriptWorld world)
      Get the WebKitWebFormManager of this WebPage in world.
      Parameters:
      world - a WebKitScriptWorld
      Returns:
      a WebKitWebFormManager
      Since:
      2.40
    • getId

      public long getId()
      Get the identifier of the WebKitWebPage
      Returns:
      the identifier of this WebPage
    • getMainFrame

      @Deprecated public Frame getMainFrame()
      Deprecated.
      Returns the main frame of a WebKitWebPage.
      Returns:
      the WebKitFrame that is the main frame of this WebPage
      Since:
      2.2
    • getUri

      public String getUri()

      Returns the current active URI of webPage.

      You can monitor the active URI by connecting to the notify::uri signal of webPage.

      Returns:
      the current active URI of webView or null if nothing has been loaded yet.
    • sendMessageToView

      public void sendMessageToView(UserMessage message, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      Send message to the WebKitWebView corresponding to webPage. If message is floating, it's consumed.

      If you don't expect any reply, or you simply want to ignore it, you can pass null as callback. When the operation is finished, callback will be called. You can then call webkit_web_page_send_message_to_view_finish() to get the message reply.

      Parameters:
      message - a WebKitUserMessage
      cancellable - a GCancellable or null to ignore
      callback - A GAsyncReadyCallback to call when the request is satisfied or null
      Since:
      2.28
    • sendMessageToViewFinish

      public UserMessage sendMessageToViewFinish(AsyncResult result) throws GErrorException
      Finish an asynchronous operation started with webkit_web_page_send_message_to_view().
      Parameters:
      result - a GAsyncResult
      Returns:
      a WebKitUserMessage with the reply or null in case of error.
      Throws:
      GErrorException - see GError
      Since:
      2.28
    • onConsoleMessageSent

      Emitted when a message is sent to the console. This can be a message produced by the use of JavaScript console API, a JavaScript exception, a security error or other errors, warnings, debug or log messages. The consoleMessage contains information of the message.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      2.12
      See Also:
    • emitConsoleMessageSent

      public void emitConsoleMessageSent(@Nullable ConsoleMessage consoleMessage)
      Emits the "console-message-sent" signal. See onConsoleMessageSent(WebPage.ConsoleMessageSentCallback).
    • onContextMenu

      Emitted before a context menu is displayed in the UI Process to give the application a chance to customize the proposed menu, build its own context menu or pass user data to the UI Process. This signal is useful when the information available in the UI Process is not enough to build or customize the context menu, for example, to add menu entries depending on the node at the coordinates of the hitTestResult. Otherwise, it's recommended to use WebKitWebView::context-menu signal instead.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      2.8
      See Also:
    • emitContextMenu

      public boolean emitContextMenu(@Nullable ContextMenu contextMenu, @Nullable WebHitTestResult hitTestResult)
      Emits the "context-menu" signal. See onContextMenu(WebPage.ContextMenuCallback).
    • onDocumentLoaded

      This signal is emitted when the DOM document of a WebKitWebPage has been loaded.

      You can wait for this signal to get the DOM document

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitDocumentLoaded

      public void emitDocumentLoaded()
      Emits the "document-loaded" signal. See onDocumentLoaded(WebPage.DocumentLoadedCallback).
    • onSendRequest

      This signal is emitted when request is about to be sent to the server. This signal can be used to modify the WebKitURIRequest that will be sent to the server. You can also cancel the resource load operation by connecting to this signal and returning true.

      In case of a server redirection this signal is emitted again with the request argument containing the new request to be sent to the server due to the redirection and the redirectedResponse parameter containing the response received by the server for the initial request.

      Modifications to the WebKitURIRequest and its associated SoupMessageHeaders will be taken into account when the request is sent over the network.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitSendRequest

      public boolean emitSendRequest(@Nullable URIRequest request, @Nullable URIResponse redirectedResponse)
      Emits the "send-request" signal. See onSendRequest(WebPage.SendRequestCallback).
    • onUserMessageReceived

      This signal is emitted when a WebKitUserMessage is received from the WebKitWebView corresponding to webPage. You can reply to the message using webkit_user_message_send_reply().

      You can handle the user message asynchronously by calling g_object_ref() on message and returning true. If the last reference of message is removed and the message has been replied, the operation in the WebKitWebView will finish with error UserMessageError.USER_MESSAGE_UNHANDLED_MESSAGE.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      2.28
      See Also:
    • emitUserMessageReceived

      public boolean emitUserMessageReceived(@Nullable UserMessage message)
      Emits the "user-message-received" signal. See onUserMessageReceived(WebPage.UserMessageReceivedCallback).
    • builder

      public static WebPage.Builder<? extends WebPage.Builder> builder()
      A WebPage.Builder object constructs a WebPage with the specified properties. Use the various set...() methods to set properties, and finish construction with WebPage.Builder.build().
      Returns:
      the builder object