Accessing the DOM from a Firefox for Android add-on

Brandon Young

I am attempting(and failing) to insert elements into every page visited. I am only able to insert elements into the initial page(the page displayed after the add-on has been installed). The code snippet below demonstrates this behaviour.

I have tried placing the logic that inserts the H1 element within onOpenWindow(), although that doesn't seem to make any difference.

NOTE: The code below is in addition to template boilerplate code

const { classes: Cc, interfaces: Ci, utils: Cu } = Components;

Cu.import('resource://gre/modules/Services.jsm');

function loadIntoWindow(window) {
  if (!window)
    return;

    window.NativeWindow.toast.show("Inserting script", "short");

   var contentWindow = window.BrowserApp.selectedBrowser.contentWindow;
    var document = contentWindow.document;
    document.body.innerHTML = "<h1>THIS TEXT WAS INSERTED</h1>";  
}
Noitidart
    var DOMWindows = Services.wm.getEnumerator('navigator:browser');
    while (DOMWindows.hasMoreElements()) {
        var aDOMWindow = DOMWindows.getNext();
        var allTabs = aDOMWindow.BrowserApp._tabs;
        for (var i=0; i<allTabs.length; i++) {
            var aContentWindow = allTabs[i].window;
        }
    }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Accessing the DOM in a Firefox for Android add-on

From Dev

Accessing to DOM functions from Firefox extension

From Dev

Accessing Firefox Add-on SDK from Bootstrapped extension

From Dev

Accessing Firefox Add-on SDK from Bootstrapped extension

From Dev

Accessing a specific element from the DOM

From Dev

Block firefox from accessing webcam

From Dev

Accessing the DOM tree from an Electron child process

From Dev

Problems Accessing DOM from Browserify Module

From Dev

Accessing Google Drive from a Firefox extension

From Dev

Block chrome or firefox from accessing localhost

From Dev

accessing Android API from browser

From Dev

accessing Android API from browser

From Dev

Accessing navigator.plugins in Firefox using Add-on SDK

From Dev

Aurelia - Accessing ViewModel functions/binding from within Generated DOM elements

From Dev

Accessing a DOM attached function in an iframe from the parent window

From Dev

Aurelia - Accessing ViewModel functions/binding from within Generated DOM elements

From Dev

Firefox Addon - Accessing pre-loaded content script from ActionButton

From Dev

Accessing a firefox addon's functions from a simple website

From Dev

Running JavaScript on current page once loaded from a Firefox for Android add-on

From Dev

accessing cloud storage directly from an android application

From Dev

Accessing GoogleMap from outside the UI thread in Android

From Dev

accessing gpio from within kivy android app

From Dev

Android Realm - Accessing Realm Object from Service

From Dev

Accessing variables from another class Android Studio

From Dev

Accessing drawable file from String Arraylist in android

From Dev

Accessing images from JAR library in Android

From Dev

Accessing native android methods from webview

From Dev

Accessing values from service to activity Android

From Dev

Accessing another database in MySQL from Android app

Related Related

  1. 1

    Accessing the DOM in a Firefox for Android add-on

  2. 2

    Accessing to DOM functions from Firefox extension

  3. 3

    Accessing Firefox Add-on SDK from Bootstrapped extension

  4. 4

    Accessing Firefox Add-on SDK from Bootstrapped extension

  5. 5

    Accessing a specific element from the DOM

  6. 6

    Block firefox from accessing webcam

  7. 7

    Accessing the DOM tree from an Electron child process

  8. 8

    Problems Accessing DOM from Browserify Module

  9. 9

    Accessing Google Drive from a Firefox extension

  10. 10

    Block chrome or firefox from accessing localhost

  11. 11

    accessing Android API from browser

  12. 12

    accessing Android API from browser

  13. 13

    Accessing navigator.plugins in Firefox using Add-on SDK

  14. 14

    Aurelia - Accessing ViewModel functions/binding from within Generated DOM elements

  15. 15

    Accessing a DOM attached function in an iframe from the parent window

  16. 16

    Aurelia - Accessing ViewModel functions/binding from within Generated DOM elements

  17. 17

    Firefox Addon - Accessing pre-loaded content script from ActionButton

  18. 18

    Accessing a firefox addon's functions from a simple website

  19. 19

    Running JavaScript on current page once loaded from a Firefox for Android add-on

  20. 20

    accessing cloud storage directly from an android application

  21. 21

    Accessing GoogleMap from outside the UI thread in Android

  22. 22

    accessing gpio from within kivy android app

  23. 23

    Android Realm - Accessing Realm Object from Service

  24. 24

    Accessing variables from another class Android Studio

  25. 25

    Accessing drawable file from String Arraylist in android

  26. 26

    Accessing images from JAR library in Android

  27. 27

    Accessing native android methods from webview

  28. 28

    Accessing values from service to activity Android

  29. 29

    Accessing another database in MySQL from Android app

HotTag

Archive