vendredi 8 juin 2018

Loop not activating on keypress

So in my content script, the second 'else if' statement does not seem to actually run at all.

//URL identifying
var currenturlval;
   ...
} else if (geturl.includes('mail.google.')) {
    currenturlval = 'gmail';
    console.log(currenturlval); // this prints when on gmail
}
   ...
document.body.onKeyDown = function {
   ...
else if (currenturlval == 'gmail') {
        console.log("test"); //this does not print
        var gmailinput = document.querySelector('[aria-label="Message Body"][role="textbox"]');
        extractinputdata(gmailinput);
    }
   ...

No error messages pop-up in the console, and this loop works for other sites (ie. twitter and facebook). Not sure why gmail does not work.

Aucun commentaire:

Enregistrer un commentaire