PayFanout API reference
    Preparing search index...

    Function injectStylesheet

    • Injects a PSP stylesheet <link rel="stylesheet"> once per page (idempotent via DOM lookup on href) and resolves when the sheet loads. Styling is cosmetic, so a load failure, including a sheet that fails its options.integrity check, resolves as well. The link stays on the page either way: a browser can also fire error on a link whose own rules applied when one of the sheets it @imports fails, and the page cannot tell that from a sheet that failed, so a later call for url finds the link and resolves at once instead of fetching the sheet again. An empty url names no sheet, and a link with an empty href fires neither event, so nothing is injected and the call resolves at once. The call rejects for invalid options, with a non-retryable invalid_request attributed to pspName, and nothing is injected then; a url holding a double quote also rejects, with the DOM's own error, since the page lookup cannot quote it.

      A <link rel="stylesheet"> already on the page for url is reused as it is, with nothing injected and none of its attributes compared: one the page added itself keeps an integrity check only if it carries its own integrity and crossorigin. A link of another type for url, such as rel="preload", is not a match. If an earlier call injected that link and it is still loading, the call waits for it and resolves once it loads or fails; any other link resolves the call at once. There is no timeout: a link that fires neither event keeps every call waiting on it pending. A browser fires load only once the sheets a stylesheet @imports have loaded or failed, so a caller that must not wait on their hosts should not await the call.

      Parameters

      Returns Promise<void>