WebBrowser enhancements

The WebBrowser control supports executing JavaScript by the following functions and events:

  • EvaluateJavascriptAsync function -- Executes JavaScript asynchronously. This function triggers the EvaluateJavascriptFinished event.

    EvaluateJavascriptAsync (string javascript)
  • EvaluateJavascriptSync function -- Executes JavaScript synchronously.

    EvaluateJavascriptSync (string javascript{, ref string result{, ref string error}})
  • EvaluateJavascriptFinished event -- Triggered after the EvaluateJavascriptAsync function is executed.

    EvaluateJavascriptFinished (string result, string error)
  • RegisterEvent function -- Registers the user defined event so that it can be triggered in JavaScript.

    RegisterEvent (string eventname)

    PowerBuilder user events can be defined with one string-type parameter and string-type return value. For more, see the section called “Defining user events for WebBrowser”.

  • UnregisterEvent function -- Unregisters the user defined event that is registered using the RegisterEvent function.

    UnregisterEvent (string eventname)

The WebBrowser control supports basic and digest authentications:

  • When the web page to be accessed needs basic or digest authentication, the WebBrowser control will automatically display a login window for the user to enter the username and password for authentication. If the authentication fails, this window will display again until the authentication is successful or the authentication operation is cancelled.

The WebBrowserSet and WebBrowserGet functions are enhanced to support to access the local files and resources:

  • allow-file-access-from-files -- Whether to allow access to the local files (XML etc.).

  • enable-media-stream -- Whether to allow access to the microphone or camera.