Skip to content
This repository has been archived by the owner on Jun 17, 2019. It is now read-only.
/ inject Public archive

Inject a script into a page from a browser extension

License

Notifications You must be signed in to change notification settings

vk-x/inject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project has been merged into the vk-x monorepo

inject

For use inside Chrome extensions. Injects scripts into the page context.

inject = require("@vk-x/inject")

// File name will be resolved with chrome.extension.getURL()
inject("path/to/file.js")

// Pass true as the second argument to inject the string itself as code.
inject("console.log('Inline code')", true)

// Functions are automatically stringified and wrapped into an IIFE.
inject(function() { console.log("I'm injected!") })

About

Inject a script into a page from a browser extension

Resources

License

Stars

Watchers

Forks

Packages

No packages published