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

[bug] Download attachment got blocked on Safari iOS popup blocker #204

Open
pkarw opened this issue Oct 4, 2024 · 0 comments
Open

[bug] Download attachment got blocked on Safari iOS popup blocker #204

pkarw opened this issue Oct 4, 2024 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@pkarw
Copy link
Contributor

pkarw commented Oct 4, 2024

example workaround (?):

  const onMouseClick = async () => {
    var windowReference = window.open()
    try {
      const apiResponse = await getFacturaPdfByNrFac(nrFactura.replace("/", ""))
      if (apiResponse.type) {
        var url = createObjectURL(apiResponse)
        windowReference.location = url
      }
    } catch (error) {
      console.error(error)
    }
  }

export function createObjectURL(file) {
  if (window.webkitURL) {
    return window.webkitURL.createObjectURL(file)
  } else if (window.URL && window.URL.createObjectURL) {
    return window.URL.createObjectURL(file)
  } else {
    return null
  }
}
@pkarw pkarw added the bug Something isn't working label Oct 4, 2024
@pkarw pkarw added this to the v1.0.0-beta-3 milestone Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant