Jump to content

Don't add custom search engines to browsers Chrome-based


Sampei.Nihira

Recommended Posts

It bothers me a lot every now and then to eliminate from the list of the search engines, some personalized engines added without my consent in the normal navigation.

You can use this extension to eliminate this inconvenience:

 

https://chrome.google.com/webstore/detail/dont-add-custom-search-en/dnodlcololidkjgbpeoleabmkocdhacc?ucbcb=1

 

But is there another valid method without using any extension?:dubbio:

Link to comment
Share on other sites

  • 1 year later...

  • 2 weeks later...

On Chrome Web Store, under this extension User Reviews, I've found this user review:

"Lee Hodsdon May 6, 2019

... Alas, in a new PC build, I lost the user-defined rules that I had in uBlock Origin. I remember figuring out a rule that would kill sites from adding their searches to Chrome. There was a directive in the page to perform the auto-add, and it was that element that I had blocked in uBO. I'll add another reply if I figure it out again. With that rule in uBO, I monitored the search engine list in Chrome and none got auto-added after several months."

- so search for this uBlock rule...

Link to comment
Share on other sites

On 4/21/2023 at 9:39 AM, msfntor said:

On Chrome Web Store, under this extension User Reviews, I've found this user review:

"Lee Hodsdon May 6, 2019

... Alas, in a new PC build, I lost the user-defined rules that I had in uBlock Origin. I remember figuring out a rule that would kill sites from adding their searches to Chrome. There was a directive in the page to perform the auto-add, and it was that element that I had blocked in uBO. I'll add another reply if I figure it out again. With that rule in uBO, I monitored the search engine list in Chrome and none got auto-added after several months."

- so search for this uBlock rule...

The rules I have,some time ago,added to uBlock Origin did not prevent the automatic addition of some search engines,so I went back to the extension.

I probably don't have the expertise to do this work.

Certainly mr. Hill himself could do it (but I know his grumpy nature so he wouldn't).
Another candidate who might succeed would be Yuki2718.

Link to comment
Share on other sites

On 4/21/2023 at 9:51 AM, msfntor said:

I use sometimes Safer Redirects extension: https://chrome.google.com/webstore/detail/safer-redirects/ecejaaoknpcjfheoejampbickooodnna

- you could find another similar one (or Domain Whitelist?..), and post here your findings... 

This question is OT.
And I would not usually answer it.

I recently returned from a trip to Sicily (3 hours from the city where Giorgio Maone resides) so I will make an exception for you.;)

I would use (but do not use) this extension:

 

https://chrome.google.com/webstore/detail/skip-redirect/jaoafjdoijdconemdmodhbfpianehlon

 

:hello:

Link to comment
Share on other sites

  • 3 months later...

In old 360chrome 13.x, it suffices to save and copy over the profile the extensionless Preferences AND Webv Data files (which you should save once all settings, including search engines, are done).

Link to comment
Share on other sites

On 3/27/2022 at 7:14 AM, Sampei.Nihira said:

But is there another valid method without using any extension?:dubbio:

Since this thread has been revived and I missed it the first time around.

I use the below to prevent custom search engines from being added -

// ==UserScript==
// @name - Disable OpenSearch
// @version 2.0.1
// @include http*://*
// @run-at document-start
// ==/UserScript==

//document.querySelector('[type="application/opensearchdescription+xml"]').remove();
//////////////////////////////////////////////////////////////////////////////
// Code from https://github.com/gregsadetsky/chrome-dont-add-custom-search-engines/blob/master/src/content.js
// OpenSearch - e.g., https://martin-thoma.com/search-engine-autodiscovery/
// Uses CSS4 selectors, Chrome 49+
const DEBUG=false;
let numseen=0, numspoiled=0;
let unspoiled=[];

// called when the user clicks an element of the form (any field or button).
// The parameter passed is the event object.
function clickApply(e) {
    if(DEBUG) console.info({'form onclick':e});
    // remove onclick. One fix only
    e.srcElement.form.removeEventListener("click", clickApply);
    applyFix(e.srcElement.form);
} //clickApply

// add a new <textarea> element
function applyFix(elem) {
  var newelem = document.createElement('textarea');
  newelem.name = '';
  newelem.style.display='none';
  elem.appendChild(newelem);
} //applyFix

// Add an extra child input to any form that only has one
function spoilFormGet(elem) {
    if(DEBUG) {
        ++numseen;
        unspoiled.push(elem);
    }

    // Check whether the form submits to a HTTP(S) URL.
    // A missing or relative action will be resolved against the page URL
    // so it must have the same URI scheme which is all we care about
    var action = elem.getAttribute('action');
    if(!(action && action.indexOf('://') >= 0)) action = location.href;
    if(!/^https?:\/\//i.test(action)) return;

    // Autodetection requires exactly one input of type text or search
    // If the type attribute is missing, it defaults to `text`
    // Readonly inputs do not count against this total
    if(elem.querySelectorAll(':scope input:-webkit-any([type="text" i],[type="search" i],[type*="search" i],[type=""],:not([type])):not([readonly])[name]:not([name=""])').length !== 1) return;

    // Autodetection also requires no password, file, or textarea elements
    if(elem.querySelector(':scope :-webkit-any(input[type="password" i],input[type="file" i],textarea)')) return;

    // Add a <textarea> - unlike <input>, it doesn't block implicit submission
    // per https://www.tjvantoll.com/2013/01/01/enter-should-submit-forms-stop-messing-with-that/

    // apply the fix now, or place it in onclick.  "this" is a parameter passed by foreach(). see below
    if (this.now === true) {
        // remove onclick placed during first pass
        elem.removeEventListener("click", clickApply);
        // and instead do it now;
        applyFix(elem);
    } else {
        elem.addEventListener('click', clickApply);
    }

    if(DEBUG) {
        console.info({Spoiled: elem});
        ++numspoiled;
        unspoiled.pop();
    }
} //spoilFormGet

var debugAutoDetect=0;

// move this part of the code here, since it's called multiple times
function autoDetect(now, when_called) {
    if(DEBUG) console.log('autoDetect: '+(++debugAutoDetect)+' ('+when_called+')');
    document.querySelectorAll('form:-webkit-any([method="get" i],:not([method]))').forEach(spoilFormGet,{now});
    if(DEBUG) {
        console.log(`Spoiled ${numspoiled}/${numseen}.`+(unspoiled.length?'  Unspoiled were:':'') );
        if (unspoiled.length) console.log(unspoiled);
    }

    // we reset spoil vars for next call
    numseen=0;
    numspoiled=0;
    unspoiled=[];
} //autoDetect

function catchOpenSearch() {
    if(DEBUG) console.info('catchOpenSearch called');
    // OpenSearch - e.g., https://martin-thoma.com/search-engine-autodiscovery/
    // Uses CSS4 selectors, Chrome 49+
    document.querySelectorAll('[type="application/opensearchdescription+xml" i]').forEach(
        function (it) {
            it.removeAttribute('type');
            if(DEBUG) console.info({"Spoiled by type removal": it});
        }
    );

    // Suggestion service, https://www.chromium.org/tab-to-search
    document.querySelectorAll('url[rel="suggestions" i]').forEach(
        function (it) {
            it.removeAttribute('rel');
            if(DEBUG) console.info({"Spoiled by rel removal": it});
        }
    );

  // added
    document.querySelectorAll('url[rel="search" i]').forEach(
        function (it) {
            it.removeAttribute('rel');
            if(DEBUG) console.info({"Spoiled by rel removal": it});
        }
    );
} //catchOpenSearch

function onDOMContentLoaded() {
    if(DEBUG) console.log('onDOMContentLoaded');

    catchOpenSearch();

    // #1 call it now (i.e., DOMContentLoaded) without applying the fix
    // #2 call it in 1500 ms and apply the fix
    // #3 call when document loaded, and apply the fix.

    // if <form> is added/modified // dynamically before the document
    // is fully loaded, #1 could miss it, but not #2 & #3. Note that #2
    // could fire after #3 if the page is fast to load.  Once the fix
    // is applied, the <form> can't be found by subsequent execution
    // of autoDetect, so the fix can only be applied once (#1 is not
    // applied but delayed until #2 or #3 fires, or if the user
    // clicks).

    window.addEventListener('load', function() {
        if(DEBUG) console.log('onload');
        catchOpenSearch();
        autoDetect(true,'Load');
    } );  // #3
    setTimeout(function() { autoDetect(true,'Timer'); } ,1500);     // #2
    autoDetect(false,'onClick');                                    // #1

} //onDOMContentLoaded

(function() {
    document.addEventListener('DOMContentLoaded', onDOMContentLoaded);
    onDOMContentLoaded();
})();

Link to comment
Share on other sites

Twitter and Facebook are blocked at the router-leve here.  I have no use for them and I block them completely.

Not sure what you mean by "perform a test".

I use Proxomitron and view web pages source code via Proxomitron "debug".

If the word "opensearch" exists in the web pages source code, then my above userscript will prevent that "opensearch" from adding a search engine to your custum search engine list.

image.thumb.png.e8e1f878f9dfbc311e73af40419e44e8.png

image.thumb.png.dc7d6826efd93615251afee8f15efee6.png

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...