Add script code to Twitter's website

884 Views Asked by At

I've made a quick .js script to mute certain words on Twitter's website - it just hides the tweet if it contains any of the specified words.

I plan to distribute this script, but rather than having to deal with users updating from time to time, I plan to just upload the script to my website then have the addon just embed that script for Twitter's website, adding it to the code.

But how would I make it so the code "injecting" the script is added to the header of Twitter's website?

tl;dr: I want to be able to add code to Twitter's website to call a javascript file. (http://domain.tld/directory/script.js)

Thanks!

2

There are 2 best solutions below

0
On

You can't insert your part of js script on twitters website.. if you can then its a security issue from twitters website... all you can do is ... write a browser plugin and run your actions when the browser open's up the twitters page.... but not automatically inject your script when someone open a twitter website in their browser.

0
On

You could create a Chrome Extension. Extensions can inject script code into websites and have them operate in the websites scope.

http://developer.chrome.com/extensions/content_scripts.html