Function GM_getResourceURL

  • Retrieves a blob: or data: URL of a resource from the Metadata Block.

    Note: when setting this URL as src or href of a DOM element, it may fail on some sites with a particularly strict CSP that forbids blob: or data: URLs. Such sites are rare though. The workaround in Chrome is to use GM_addElement, whereas in Firefox you'll have to disable CSP either globally via about:config or by using an additional extension that modifies HTTP headers selectively.

    Parameters

    • name: string

      Name of a resource defined in the Metadata Block.

    • Optional isBlobUrl: boolean
      • If true, returns a blob: URL. It's short and cacheable, so it's good for reusing in multiple DOM elements.
      • If false, returns a data: URL. It's long so reusing it in DOM may be less performant due to the lack of caching, but it's particularly handy for direct synchronous decoding of the data on sites that forbid fetching blob: in their CSP.

    Returns string