MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / getBrowser

Function getBrowser

web/pgadmin/static/js/utils.js:355–380  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

353}
354
355export function getBrowser() {
356 if(navigator.userAgent.indexOf('Electron') >= 0) {
357 return {name: 'Electron', version: /Electron\/([\d.]+\d+)/.exec(navigator.userAgent)[1]};
358 }
359
360 let ua=navigator.userAgent,tem,M=(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i).exec(ua) || [];
361 if(/trident/i.test(M[1])) {
362 tem=/\brv[ :]+(\d+)/g.exec(ua) || [];
363 return {name:'IE', version:(tem[1]||'')};
364 }
365 if(ua.indexOf('Electron') >= 0) {
366 return {name: 'Electron', version: /Electron\/([\d.]+\d+)/.exec(ua)[1]};
367 }
368
369 if(M[1]==='Chrome') {
370 tem=(/\bOPR|Edge\/(\d+)/).exec(ua);
371 if(tem!=null) {return {name:tem[0], version:tem[1]};}
372 }
373
374 M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
375 if((tem=(/version\/(\d+)/i).exec(ua))!=null) {M.splice(1,1,tem[1]);}
376 return {
377 name: M[0],
378 version: M[1],
379 };
380}
381
382export function checkTrojanSource(content, isPasteEvent) {
383 // Call the hasTrojanSource function of 'anti-trojan-source' package

Callers 7

forceCloseFunction · 0.90
useBeforeUnloadFunction · 0.90
DownloadUtils.jsFile · 0.90
BrowserComponentFunction · 0.90
reloadPgAdminFunction · 0.90
isSaveToolDataEnabledFunction · 0.90
showMethod · 0.90

Calls 1

testMethod · 0.80

Tested by

no test coverage detected