0

I was just wondering as this code is in pure HTML with some JavaScript that gets me my current IP addresses (using jQuery AJAX call to a IPv4/v6 site) and also gets me my useragent.

However as it's all JS, I get the UA from the Navigator object rather than the headers, and using an agent switcher extension it changes the UA when I call a page that outputs the headers server side say with a google search of "what is my user-agent", but my page just gets the ua from the navigator object and it is always the true UserAgent never the switched one e.g

let ua= navigator.userAgent;
document.querySelect('#UA').innerHTML = "UserAgent: <b>" + ua + "</b>";

Is there a way to get the header / switched agent as well as or instead of the way I am getting at the moment?

halfer
  • 19,824
  • 17
  • 99
  • 186
MonkeyMagix
  • 677
  • 2
  • 10
  • 30
  • I use Brave as my browser I don't know if that has anything to do with it as it pretends to be Chrome, which is why I wrote own page to show IPv4/6 ISP, location, useragent etc using the navigator object. I also had to add in my own code to detect Brave as there is not always mention of it in the string so I use this bit of code in a Browser detect function > if(navigator.brave !== undefined){ braveAgent = (navigator.brave && navigator.brave.isBrave()) ? true : false; }else if(userAgent.indexOf("Brave") > -1){ braveAgent = true; } which seems to work so far but switchers dont fool it – MonkeyMagix Dec 31 '21 at 20:37
  • I have gone through loads of switcher tools and just like Opera which doesn't seem to have a switcher tool that fools it for some reason I cannot find a switcher that somehow overwrites or inserts code to overwrite the navigator object before the page loads. Only pages which get the UA from a header seem to work, anything that uses the navigator object fails. I thought this tool might work > https://webbrowsertools.com/useragent/?method=normal&verbose=false but it doesn't nor do any of the others that come up in the Brave/Chrome store as they all seem to use header spoofing not navigator edits – MonkeyMagix Dec 31 '21 at 20:41
  • forgive the spelling mistake in the code it is userAgentString.indexOf in the 2nd branch not userAgent.indexOf – MonkeyMagix Dec 31 '21 at 21:36

0 Answers0