Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

131
Views
Cannot redirect neither open new tab with javascript on iPhone Safari

I have this code, that used to create transaction and then redirect user to page with this transaction:

const { detect } = require('detect-browser')
const browser = detect()
...
async beginTransaction (data) {
  this.submitError = false
  if (!this.validateData()) return
  this.$store.commit('SET_LOADER', 1)

  try {
    this.captchaCounter++

    const clientOrigin = localStorage.getItem('cOrigin')

    const result = await startTransaction({
      ...data
    }, this.offerId, localStorage.getItem('market'))

    localStorage.removeItem('cOrigin')

    const route = this.$router.resolve({path: '/chat', query: { id: result.transactionId, pushNotifications: null, beCareful: null }})

    if (browser.name.toLowerCase() === 'safari' || this.$browserDetect.isSafari) {
      await this.$router.push(`/chat?id=${result.transactionId}&pushNotifications&beCareful`)
    } else {
      return window.open(route.href, '_blank')
    }
  } catch (e) {
    console.log(e)
  }
}

This code works perfectly fine with every other browser or device, but not on iPhone with Safari. I tried probably everything that could found, I was trying to use window reference, like here. I was also trying to do it using .then(() => {}) like here and even this, but nothing works.

What is the problem? Could it be problem in phone, not code? Because I have similar code that works, but it is bonded on button click:

async redirectToChat (id) {
  if (browser.name.toLowerCase() === 'safari' || this.$browserDetect.isSafari) {
    await this.$router.push(`/chat?id=${id}`)
  } else {
    const route = this.$router.resolve({path: '/chat', query: { id }})
    return window.open(route.href, '_blank')
  }
},
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!