Skip to content
← Back to Community
How do I turn a website into a chrome extension?
Profile icon
h
has Hacker Plan
icelite

How do I turn a website into a chrome extension? I would like to make one of my games into an extension.

Answered by ch1ck3n [earned 5 cycles]
View Answer
Voters
Profile icon
UnluckyFroggy
Profile icon
icelite
Comments
hotnewtop
Profile icon
ch1ck3n

https://developer.chrome.com/docs/extensions/mv2/getstarted/

once you get everything started (manifest.json and background.js)

put this in your background.js

background.js

chrome.browserAction.onClicked.addListener(function(activeTab){ var newURL = "http://replit.com/"; chrome.tabs.create({ url: newURL }); });

manifest.json:

{ "name": "My game", "version": "1.0", "description": "My game!", "background": { "scripts": ["background.js"], "persistent": false }, "manifest_version": 2 }

and go to chrome->extensions and turn developer mode on.

image

click load unpacked, and click on the folder where your manifest.json and background.js are.

hope this helped

Profile icon
ch1ck3n

@ch1ck3n This one is best because i taught you how to do it

Profile icon
icelite

thanks so much! @ch1ck3n

Profile icon
ch1ck3n

@Ravens0606 pumps fist
i finally got a marked answer

Profile icon
RixTheTyrunt

Not working.

Profile icon
RixTheTyrunt

JS:

chrome.browserAction.onClicked.addListener(function(activeTab){ var newURL = "https://bananastronk.repl.co"; chrome.tabs.create({url: newURL }); });

Manifest:

{ "name": "BananaStronk!", "version": "2022.1.1", "description": "", "background": { "scripts": ["background.js"], "persistent": false }, "manifest_version": 2 }
Profile icon
RixTheTyrunt

Error:

Uncaught TypeError: Cannot read properties of undefined (reading 'onClicked')

Profile icon
RixTheTyrunt

Nevermind.

Profile icon
InvisibleOne
Profile icon
UnluckyFroggy

What do you mean by that? Like a chrome app? or a redirect extension that takes people to your website?

Profile icon
ch1ck3n

@UnluckyFroggy unbanned eh