htmx 4.0 is under construction — migration guide

htmx.config.mode

Set request mode for fetch API

The htmx.config.mode option sets the mode option for fetch requests.

Default: "same-origin"

Valid Values

  • "same-origin" - Only allow same-origin requests
  • "cors" - Allow cross-origin requests
  • "no-cors" - Limited cross-origin requests
  • "navigate" - Navigation mode

Example

htmx.config.mode = "cors";
<meta name="htmx-config" content='{"mode":"cors"}'>