Skip to content

Instantly share code, notes, and snippets.

@aont
Created October 11, 2024 07:47
Show Gist options
  • Save aont/d67016882aa379e88fabebd24e68dd2f to your computer and use it in GitHub Desktop.
Save aont/d67016882aa379e88fabebd24e68dd2f to your computer and use it in GitHub Desktop.
(function() {
let browserName;
if(navigator.userAgentData) {
var brandSpecific = navigator.userAgentData.brands.find(function(brand) {return brand.brand == "Google Chrome" || brand.brand == "Microsoft Edge";})
if(brandSpecific) {
browserName = brandSpecific.brand + " " + brandSpecific.version;
} else {
browserName = navigator.userAgentData.brands.map(function (brand, index, array) { return brand.brand + " " + brand.version; }).join(", ")
}
} else {
browserName = navigator.userAgent;
}
var a = document.createElement("a");
a.onclick = function() {
var s = window.screen;
var w = window.open("about:blank", "_blank", "popup,location=0,menubar=no,toolbar=no,location=no,status=no,scrollbars=no,width=300,height=100,left="+s.availWidth.toString()+",top="+s.availHeight.toString());w.document.write("<a href=about:blank target=_blank>"+browserName+"</a>");
};
a.click();
a.remove();
})();
!function(){let browserName;if(navigator.userAgentData){var brandSpecific=navigator.userAgentData.brands.find((function(brand){return"Google Chrome"==brand.brand||"Microsoft Edge"==brand.brand}));browserName=brandSpecific?brandSpecific.brand+" "+brandSpecific.version:navigator.userAgentData.brands.map((function(brand,index,array){return brand.brand+" "+brand.version})).join(", ")}else browserName=navigator.userAgent;var a=document.createElement("a");a.onclick=function(){var s=window.screen,w;window.open("about:blank","_blank","popup,location=0,menubar=no,toolbar=no,location=no,status=no,scrollbars=no,width=300,height=100,left="+s.availWidth.toString()+",top="+s.availHeight.toString()).document.write("<a href=about:blank target=_blank>"+browserName+"</a>")},a.click(),a.remove()}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment