Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
The Internet Java

Brave Now Lets You Inject Custom JavaScript To Tweak Websites (bleepingcomputer.com) 12

Brave Browser version 1.75 introduces "custom scriptlets," a new feature that allows advanced users to inject their own JavaScript into websites for enhanced customization, privacy, and usability. The feature is similar to the TamperMonkey and GreaseMonkey browser extensions, notes BleepingComputer. From the report: "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 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.

Brave Now Lets You Inject Custom JavaScript To Tweak Websites

Comments Filter:
  • Greasemonkey (Score:5, Informative)

    by JBMcB ( 73720 ) on Monday February 10, 2025 @06:53PM (#65157375)

    Isn't this just Greasemonkey? I've been using it to fix an old webapp my company was still using but broke on modern browsers.

    • Re:Greasemonkey (Score:5, Insightful)

      by vux984 ( 928602 ) on Monday February 10, 2025 @07:03PM (#65157391)

      Yes. Except its apparently built into Brave instead of an extension. Is it news? I dunno... if you couldn't do this with Brave before with an extension, then I guess it's news. Even if you could do it with an extension not needing an extension is still news.

      I don't use Brave... I honestly don't really understand it. An ad blocking browser... supported by ads. I get that their ad model is 'different', etc, but If something was ever ripe to be enshittified the minute it got popular... this would be it.

      • I have no real affiliation to any browser. I've used many. Old opera was my favourite it did a lot of things out of the box that other browsers didn't or needed special config. I use Safari on my mac, (with adguard) I use Vivaldi at work (similar to old opera) it does a great job of maintaining state with lots of nice built in QoL enhancements. I use brave on my gaming/leisure PC. Brave definitely cuts out ads and makes youtube and other websites better. I can load it up with sponsor block and vpn plugin
      • I honestly don't really understand it. An ad blocking browser... supported by ads.

        It's ... different. As I understand it (the Brave token), it's designed to replace the original ad with one of their own. In doing so, you earn credits that they will pay directly to the original website (once the site signs up with Brave.) So the idea is that the more you visit a site, they more that they'll pay, and vice versa. (As opposed to the original site receiving money from the original 3rd party ad-company as they expected.) I don't think Brave adds any new ones, just replace the ones that app

      • Ad-supported adblockers - hypocrisy at its finest!
  • Let people make and upload these scripts, posting them for others to download. Turn them into collections that can be downloaded as a group. Let people rate them so the best ones rise to the top.

    • by Anonymous Coward
      Apologies, Poe's Law is always in force... but in case you're not joking, this already exists [tampermonkey.net].
  • by cascadingstylesheet ( 140919 ) on Monday February 10, 2025 @07:30PM (#65157435) Journal
    I wish the major browsers would bring back user stylesheets.
  • Reading the docs it looks like you can write a scriptlet that has multiple per-site JavaScript clauses that will be injected into specific websites when you visit them. In the examples they show how to remove named interface elements such as 'sidebar' from a specific site. I'm not clear as to whether you can stick just anything you want in there, including calls to code that is embedded in the website's JavaScript. But then oftentimes that code is obfuscated.

    • by znrt ( 2424692 )

      I'm not clear as to whether you can stick just anything you want in there, including calls to code that is embedded in the website's JavaScript.

      i would guess so, as long as it is somehow accessible from the global context. you won't be able to access hidden inner blocks (e.g. encapsulated in closures), at least not directly (you could supplant the whole closure).

      But then oftentimes that code is obfuscated.

      indeed and if this becomes popular it will get even more obfuscated, the usual cat and mouse game.

      then again this is a convenience for developers, who can already debug and inject arbitrary js into any page in (afaik) any browser in most situations.

      but if developers create a snippet market

Riches cover a multitude of woes. -- Menander

Working...