Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IFRAME invalid URL exception HTMX 1.9 to latest #3162

Open
robmurrer opened this issue Jan 31, 2025 · 1 comment
Open

IFRAME invalid URL exception HTMX 1.9 to latest #3162

robmurrer opened this issue Jan 31, 2025 · 1 comment

Comments

@robmurrer
Copy link

If you're HTMX page is inside a iframe. This seems to cause the verifyURL exception in the console.

PR incoming to fix

@robmurrer
Copy link
Author

So I guess the flow is to copy dev branch then send PR for code changes. Will do it eventually but for now this is the change:

Image

`/**

  • @param {Element} elt
  • @param {string} path
  • @param {HtmxRequestConfig} requestConfig
  • @return {boolean}
    */
    function verifyPath(elt, path, requestConfig) {
    let sameHost
    let url
    if (typeof URL === 'function') {
    if (document.location.href === 'about:srcdoc') {
    sameHost = false
    } else {
    url = new URL(path, document.location.href)
    const origin = document.location.origin
    sameHost = origin === url.origin
    }
} else {
// IE11 doesn't support URL
  url = path
  sameHost = startsWith(path, document.location.origin)
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant