Skip to content

Commit ea71f1e

Browse files
committed
Minor refactor
Clean up
1 parent b91adea commit ea71f1e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pdfobject.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,10 @@
2828
//Will choke on undefined navigator and window vars when run on server
2929
//Return boolean false and exit function when running server-side
3030

31-
if( typeof window === "undefined" ||
32-
window.navigator === undefined ||
33-
window.navigator.userAgent === undefined){
34-
return false;
35-
}
31+
if(typeof window === "undefined" || window.navigator === undefined || window.navigator.userAgent === undefined){ return false; }
3632

3733
let pdfobjectversion = "2.3";
3834
let nav = window.navigator;
39-
let ua = window.navigator.userAgent;
4035

4136
//Time to jump through hoops -- browser vendors do not make it easy to detect PDF support.
4237

@@ -63,6 +58,7 @@
6358
nav.maxTouchPoints > 1 );
6459

6560
//Quick test for mobile devices.
61+
let ua = nav.userAgent;
6662
let isMobileDevice = (isSafariIOSDesktopMode || /Mobi|Tablet|Android|iPad|iPhone/.test(ua));
6763

6864
//Safari desktop requires special handling

0 commit comments

Comments
 (0)