0

I want to make a chrome extension that changes the website of ROBLOX back to the 2016 UI and other stuff.

I currently have this UI in the popup: click here

I already have some code to make the checkboxes work, but how do I actually make them add some CSS and Javascript to https://roblox.com?

Edit: I already checked How to inject CSS into webpage through Chrome extension? but I want to do it programmatically.

Updates:

Sunday, November 22, 2020 17:53 Googled more, still didn't find anything Monday, November 23, 2020 17:40 Googled more, still didn't find anything. Please answer! Nothing helps or works!

ribkix
  • 3
  • 2

1 Answers1

0

Should get you started: you need to inject it into the tab you have the site open on, look at the example here on injecting CSS: Chrome extension: insertCSS once per tab

It won't be as simple as that and you'll need to add logic to replace the css via the content script.

To inject a content script:

import browser from "webextension-polyfill";
    
await browser.tabs.executeScript(tabId, {
     file: "/static/js/content.js",
});

Add /static/js/content.js and any files you want to inject to your manifest

K41F4r
  • 1,443
  • 1
  • 16
  • 36
  • Thanks, but how do I make it work for only certain domains? E.g. roblox.com – ribkix Nov 24 '20 at 11:44
  • You request permission only to that site https://developer.chrome.com/extensions/declare_permissions Also you can check which page you're on before injecting. – K41F4r Nov 24 '20 at 19:15
  • @K14F4r sorry for the very late reply, I got caught up with lots of stuff. But thanks. – ribkix Dec 17 '20 at 10:40