Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added window.alert as primary example

It is possible to invoke methods on the DOM. Below are some examples of invoking such methods

Calling "window.alert" from your plugin -
Code Block
#include "DOM/Window.h"
    // Retrieve a reference to the DOM Window
    FB::DOM::WindowPtr window = m_host->getDOMWindow();

    // Check if the DOM Window has an alert peroperty
    if (window && window->getJSObject()->HasProperty("window")) {
        // Create a reference to alert
        FB::JSObjectPtr obj = window->getProperty<FB::JSObjectPtr>("window");

        // Invoke alert with some text
        obj->Invoke("alert", FB::variant_list_of("This is a test alert invoked from an NPAPI Plugin"));


Calling "console.log" from your plugin -