Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bc48cd4

Browse files
updated the solution
1 parent a33eb8a commit bc48cd4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

‎problem-19.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
// Easy search of parameters from a URL objects.
22

3-
const url = new URL(window.location.href);
4-
const parameterValue = url.searchParams.get('pramaName');
5-
console.log(parameterValue);
3+
const detectDeviceType = () =>
4+
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|OperaMini/i.test(
5+
navigator.userAgent
6+
)
7+
? 'Mobile'
8+
: /(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(
9+
navigator.userAgent
10+
)
11+
? 'Tablet'
12+
: 'Desktop';
13+
console.log(detectDeviceType());

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /