melonJS
    Preparing search index...

    Function setOptions

    • Set the loader's global options, for every asset loaded from then on. Each option left out keeps its current value.

      Parameters

      • options: { crossOrigin?: string; nocache?: boolean; withCredentials?: boolean }

        the options to set

        • OptionalcrossOrigin?: string

          the crossOrigin attribute of the <video> and <script> elements and glTF images the loader creates ("anonymous" or "use-credentials"). Every other asset is always requested with CORS. See crossOrigin.

        • Optionalnocache?: boolean

          when true, append a random query string to every asset URL, so the browser fetches a fresh copy rather than a cached one (development only: it also defeats the HTTP cache in production)

        • OptionalwithCredentials?: boolean

          whether requests to another origin carry credentials (cookies, HTTP authentication). Requests to the game's own origin always carry them. See withCredentials.

      Returns void

      // play videos from another origin, without credentials
      loader.setOptions({ crossOrigin: "anonymous" });

      // bypass the browser cache while developing
      loader.setOptions({ nocache: true });

      // send cookies to a CDN that serves assets behind a login
      loader.setOptions({ withCredentials: true });