Tampermonkey – Form Dropdown selection with autofill verification

Filling out a signup page that checks to see if it was auto filled. I spent half the day and fount a code that worked for the text boxes posted by wOxxOm.

document.execCommand('insertText', false, 'My City');

Well below this I have document.getElementsByClassName(‘form-control’)[5]. This is a dropdown state selection. When I use the execCommand to send [5] letters they are sent back to [4]. I think it has to do with the .focus() not working on the dropdown selection. I have tried everything from jnode changes, val changes, and triggerMouseEvent. Also getelementBy/ID or NAME is not possible except thru option form-control with a number selection as they change every new visit except for form-control[1]-[8].

        waitForKeyElements (".form-control:has(option[value=AL])", selectDropdown);

function selectDropdown (jNode) {
    var evt = new Event ("click");
    jNode[0].dispatchEvent (evt);


    evt = new Event ("change");
    jNode[0].dispatchEvent (evt);

I posted this because it works until I click submit then the input is removed. I do believe a mouse selection should be able to work, but I am just at a loss right now. Any help would be appreciated.

How to prevent the browser from loading a web app in vanilla JavaScript?

I wrote the following script which I run with Greasemonkey/Tampermonkey. It’s purpose is to prevent me from accessing a few web apps (web sites), usually sites I feel a bit addicted to. This is the closest I got to prevent my Browsers to display these sites sites:

// ==UserScript==
// @name        blocko
// @include     *
// ==/UserScript==

window.addEventListener('load', function() {
    let sites = ['example-1.com', 'example-2.com', 'example-3.com'];
    let regex = /..+/;
    let href = window.location.href;
    for (let i = 0; i < sites.length; i++) {
        if (href.includes(sites[i])) {
            let domain = sites[i].replace(regex, '');
            document.body.innerHTML =`

Enough with this ${domain} bullshit!

`; } } }, true);

I must say I’m not very satisfied from my achievement here because this script gets me into the site and I need to wait 1/2/3/4 or even 5 or more seconds in rare cases, until the site will vanish and the message I print to the screen with red background will appear instead. Thus I’m unwillingly exposed to the site’s content, from which I want to avoid.

I know that it is indeed possible to prevent the browser from even moving into a website through JavaScript: There is a Chrome addon named “BlockSite” that helps with this and I tried to have a look in it’s (huge) source code but I failed to understand how it prevents the user to even move into the website, unlike my script above that moves the user to the website but vanishes the website with a message after a few seconds (after the load event was triggered).

Please share a way or at least name a way in the comments to totally prevent yourself of moving into a website, as with “BlockSite”.

Sending notification email from Javascript/Tampermonkey/Greasemonkey (without Server)

I need to send notifications from frontend, notifications are going to have analytical data from website being monitored with Tampermonkey Chrome extension.

Is this possible?

Thanks in advance.