Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda