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

141
Vistas
Window Open ignored on promise

I'm trying to redirect a user to twitter if they choose to. For that I use window.open but it just ignores that instruction. It works fine on other pages but in this function it's just not working. Any suggestions?

answerQuestion() {

        if (!this.isAnswerValid()) {
            this.presentToast('Answer must be between 1 and 140 characters')
            return
        }

        this.loading.present()
        this.questionsService.answerQuestion(this.question, this.answerText, this.imageURL)
        .then(res => {
            if (res) {
                if (this.twitter) {
                    let q = this.question.question
                    if (q.length > 100) {
                        q = q.substring(0, 101)
                    }
    
                    let a = this.answerText
                    if (a.length > 100) {
                        a = a.substring(0, 101)
                    }
                    const url = 'https://nonicapp.web.app/user/' + this.auth.user?.username
                    const tweet = q + " - " + a + " "
                    window.open('https://twitter.com/intent/tweet?text=' + tweet + '&hashtags=nonic&url=' + url, '_system')
                }
                this.router.navigateByUrl('/inbox', { replaceUrl: true });
            } else {
                this.presentToast('Something went wrong, please try again.')
            }
        })
        .catch(err => {
            console.warn(err)
            this.presentToast('Something went wrong, please try again.')
        })
        .finally(() => {
            this.loading.dismiss()
        })
    }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I also had some problems with window.open, so i started using Browser capacitor plugin

It's quite simple

import { Browser } from '@capacitor/browser';

... 

async openUrl(url) {
    await Browser.open({ url: url });
};
about 4 years ago · Juan Pablo Isaza Denunciar
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