Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
Is there any way that I can set a user agent by using HTML or JavaScript?

So I am working on a project that access a discord bot using a token in web browsers But recently, discord has changed their policy of bot requests, that make us have to manually change the user agent setting in the developer tools. Now I am wondering that is there any way that I can override the user agent setting of browser in JavaScript or HTML?

I have tried the method at here
For instance, after pasting the code:

setUserAgent(window, "BDP (http://example.com), v0.0.1)");

And it seems that it no loger work so I tried again with this
For instance:

Object.defineProperty(navigator, 'userAgent', {
    get: function () { return 'BDP (http://example.com), v0.0.1)'; }
});

But none of the method above helps me. Is there any way that I can override the user agent of browser?

Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Please try using this code.. navigator.useragent returns the browser name..

if((navigator.userAgent.indexOf("BrowserName"))
{
    //write some code
}

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda