Jump to content
  • Brave now lets you inject custom JavaScript to tweak websites


    Karlston

    • 1 comment
    • 388 views
    • 3 minutes
     Share


    • 1 comment
    • 388 views
    • 3 minutes

    Brave Browser is getting a new feature called 'custom scriptlets' that lets advanced users inject their own JavaScript into websites, allowing deep customization and control over their browsing experience.

     

    The new feature is coming in Brave Browser version 1.75 for the desktop and is very similar to the popular TamperMonkey and GreaseMonkey browser extensions, which allow users to create "user scripts" that modify the functionality of specific websites.

     

    "Starting with desktop version 1.75, advanced Brave users will be able to write and inject their own scriptlets into a page, allowing for better control over their browsing experience," explained Brave in the announcement.

     

    Brave says that the feature was initially created to debug the browser's adblock feature but felt it was too valuable not to share with users.

     

    Brave's custom scriptlets feature can be used to modify webpages for a wide variety of privacy, security, and usability purposes.

     

    For privacy-related changes, users write scripts that block JavaScript-based trackers, randomize fingerprinting APIs, and substitute Google Analytics scripts with a dummy version.

     

    In terms of customization and accessibility, the scriptlets could be used for hiding sidebars, pop-ups, floating ads, or annoying widgets, force dark mode even on sites that don't support it, expand content areas, force infinite scrolling, adjust text colors and font size, and auto-expand hidden content.

     

    For example, the script below will remove sidebars from a particular website.

    Brave Browser custom scriptlet
    Brave Browser custom scriptlet
    Source: Brave

    For performance and usability, the scriptlets can block video autoplay, lazy-load images, auto-fill forms with predefined data, enable custom keyboard shortcuts, bypass right-click restrictions, and automatically click confirmation dialogs.

     

    The possible actions achievable by injected JavaScript snippets are virtually endless. However, caution is advised, as running untrusted custom scriptlets may cause issues or even introduce some risk.

    How to use Brave scriptlets

    Brave says the scriptlets are powerful tools in the hands of knowledgeable users. At the same time, there's a risk that custom JavaScript can cause website problems.

     

    For this reason, it has placed the new feature behind a Developer mode flag in Shields > Content filtering

     

    You can access the new feature by going to "brave://settings/shields/filters," enabling "Developer mode," and then clicking on the "Add new scriptlet" button.

     

    Enabling the new feature
    Enabling the new feature
    Source: BleepingComputer

    A box will appear warning the user they should not paste code they don't understand as this could result in privacy risks.

    Adding a new scriptlet
    Adding a new scriptlet
    Source: BleepingComputer

    Brave's custom scriptlet feature follows filter rule syntax similar to ad-blocking rules in uBlock Origin or AdGuard. For more information on that, check here.

     

    Those interested in experimenting with Brave's new feature should only use their own code or those of people they trust, strictly avoiding anything that hasn't been thoroughly scrutinized.

     

    It is also possible to subscribe to existing adblock filter lists, so that their rules are automatically used in Brave.

     

    Source


    Hope you enjoyed this news post.

    Thank you for appreciating my time and effort posting news every day for many years.

    News posts... 2023: 5,800+ | 2024: 5,700+ | 2025 (till end of January): 487

    RIP Matrix | Farewell my friend  :sadbye:

    • Like 2

    User Feedback

    Recommended Comments

    Needed because some of the more scurrilous and despicable companies, like eBay, are starting to put their unwanted web page elements inside what's called a shadow DOM. That essentially stops ad and content blockers from directly removing them.

     

    I spent the best part of a day coding a Tampermonkey script to remove, I kid you not, over 450 unwanted item tiles from a page that I opened for a SINGLE item. Blocks of 25 tiles with idiotic names like "More sponsored items", "Similar sponsored items" littered the single item's page. That's right, I wanted to look at just ONE item and eBay added another nearly 500 ads for other items. And removing them once was not enough, eBay brought them back again and again. I had to make the script's code run a few times per second to stop eBay's crap permanently.

    Link to comment
    Share on other sites




    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.
    Note: Your post will require moderator approval before it will be visible.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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