Skip to content

Instantly share code, notes, and snippets.

@vBm
Created July 12, 2014 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vBm/85a254006b6182bb59ba to your computer and use it in GitHub Desktop.
Save vBm/85a254006b6182bb59ba to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name GM_getResourceURL Tester
// @namespace testing
// @include http://www.greasespot.net/*
// @resource icon https://assets-cdn.github.com/favicon.ico
// @grant GM_getResourceURL
// ==/UserScript==
var favicon_link_html = document.createElement('link');
favicon_link_html.rel = 'icon';
favicon_link_html.href = GM_getResourceURL('icon');
favicon_link_html.type = 'image/x-icon';
document.getElementsByTagName('head')[0].appendChild( favicon_link_html );
@BrockA
Copy link

BrockA commented Jul 13, 2014

I think this is just how Firefox does <link> handling (don't want to lookup how I did it before).

If you do:

$("body").append ('<img src="' + GM_getResourceURL('icon') + '">');

(After requiring jQuery) It works. This suggests that GM_getResourceURL() is not at fault.

@vBm
Copy link
Author

vBm commented Jul 14, 2014

I still can't get it to work in GM. like i've already said in the ticket itself, works like a charm in TM/Chrome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment