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

193
Views
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 answers
Answer question

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 Report
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!