Saturday, June 15, 2024
HomeiOS Developmentjavascript - Dynamic anchors not wotking in Chrome if bookmarked in residence

javascript – Dynamic anchors not wotking in Chrome if bookmarked in residence


I’ve created an online utility that allow consumer view some PDF created on the fly on server facet as following:

  • the consumer clicks on a button and make an API request to the backend with some information wanted to generate a dynamic PDF
  • the backend generates the file, then shops it in a S3 bucket, additionally produces a presigned URL in reply to the shopper.
  • the shopper receives again the url after which creates a brief “a” node ingredient which is programmatically clicked to keep away from futher interactions for consumer

The javascript code is that this:

async previewFileApi(methodology, url, config) {
      const consequence = await this.$axios.request({
        methodology,
        url,
        ...config,
      })
      const { presigned_url } = consequence.information
      const a = doc.createElement('a')
      doc.physique.appendChild(a)
      a.fashion.show = 'none'
      a.href = presigned_url
      a.goal="_blank"
      a.click on()
      setTimeout(() => {
        doc.physique.removeChild(a)
      }, 500)
    },

This method works completely in Chrome on all platforms, till the webapp is added to iOS residence web page as bookmark. In that case the API request takes place however the PDF is just not opened in any respect (if the webapp is used with out bookmarking, nonetheless works on iOS)
Alternatively, static PDF recordsdata linked with related “a” dom nodes and goal “_blank” could be opened with out issues in my webapp, each bookmarked or not.

What I am doing flawed?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments