Skip to content

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

@pkarw

Description

@pkarw

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
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions