Basically I made a bookmarklet, and I'd like it to run when a certain wildcarded URL is opened. For some reasons it won't simply run as javascript in a chrome extension, and I'm tired of trying.
What I think could work is to make an extension that has a content_script
for the specified page(s) (which allows a wildcard via match
), and somehow make it do the same thing that would be done if the user clicked the bookmarklet in the bookmarks bar.
However, I do not know how to make this.
One thing to note is that I need it to access the page's global scope, i.e., break out of the extension sandbox (which is possible, and has been confirmed to be possible by design in the Chromium bug tracker).
So the question again is: how, from an content_script
, do I "load the bookmarklet" (in other words, how to convert a bookmarklet to a Google Chrome extension). I have it in plain javascript too, if that could be of use.
This is the bookmarklet, in case somebody wants to test with it. It's meant to be used at my.deviantart.com/messages/*
(but you need an account and messages in your inbox, to see the effect hover on top of a link to a "deviation", and it will show a tooltip with a thumbnail of it).
(Edit: Here's an extension attempt, posted in an answer's comments)