JavaScript È°¿ëÆÁ
2022.02.28 / 23:17

[Script] PC or ¸ð¹ÙÀÏ Á¢¼Ó üũ

MyData
Ãßõ ¼ö 94

ÀÚ¹Ù½ºÅ©¸³Æ®·Î PC ¿¡¼­ Á¢¼ÓÇß´ÂÁö, ¸ð¹ÙÀÏ ±â±â·Î Á¢¼ÓÇß´ÂÁö ¿©ºÎ¸¦ °¡¸®±â À§ÇØ ¾Æ·¡¿Í °°ÀÌ Ã³¸®ÇÏ¿´´Ù.

¼Ò½º´Â http://stove99.tistory.com/87 ¿¡¼­ Âü°íÇÏ¿´´Ù.

var filter = "win16|win32|win64|mac|macintel";


if( navigator.platform  ){

if( filter.indexOf(navigator.platform.toLowerCase())<0 ){

alert("¸ð¹ÙÀÏ ±â±â¿¡¼­ Á¢¼Ó");

// ¾Æ·¡ ÁÖ¼Ò·Î À̵¿ÇÑ´Ù.

location.href = "http://m.daum.net/";

}else{

alert("PC¿¡¼­ Á¢¼Ó");

}

}


´ëºÎºÐÀÇ »ç¿ëÀÚµéÀÌ Windows OS À̰ųª MAC OS ÀÏ °ÍÀ̱⠶§¹®¿¡ À§¿Í °°À̠ó¸®ÇÏ¿´À¸³ª navigator.platform ·Î ó¸®ÇÏ¿´À» °æ¿ì¿¡ Return µÇ´Â °ªµéÀÌ ¹«¾ùÀÎÁö Âü°í¸¦ ÇØµÎ¸é ´õ ÁÁÀ» °Í °°¾Æ¼­ ¾Æ·¡ »çÀÌÆ®¿¡ ÀÖ´ø ³»¿ëÀ» ³ªÀÇ ºí·Î±×¿¡µµ ¿Å°Üº»´Ù.


»çÀÌÆ® ³»¿ë ÀÚü¸¦ º¹»çÇؼ­ ³Ö¾úÀ¸³ª ¿¹»Ú°Ô º¹»çµÇÁö¸¦ ¾Ê¾Æ¼­ °¡±ÞÀûÀÌ¸é »çÀÌÆ®¿¡ Á÷Á¢ ¹æ¹®Çؼ­ º¸±â¸¦ ¹Ù¶õ´Ù.

¿µ¹® »çÀÌÆ®À̱â´Â Çϳª ÁÁÀº ³»¿ëÀÌ ¸¹ÀºµíÇÏ´Ù.


http://www.w3schools.com/jsref/prop_nav_platform.asp





Navigator platform Property

Navigator Object Reference Navigator Object

Example

Return the version of your browser:

var x = "Platform: " + navigator.platform;

The result of x will be:

Platform: Win32

Try it yourself »

Definition and Usage

The platform property returns for which platform the browser is compiled.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The platform property is supported in all major browsers.


Syntax

navigator.platform

Return Value

TypeDescription
StringThe platform of the browser. Possible values:
  • HP-UX
  • Linux i686
  • Linux armv7l
  • Mac68K
  • MacPPC
  • MacIntel
  • SunOS
  • Win16
  • Win32
  • WinCE
  • Etc..



More Examples

Example

A demonstration of all navigator properties in one example:

txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt+= "<p>Browser Name: " + navigator.appName + "</p>";
txt+= "<p>Browser Version: " + navigator.appVersion + "</p>";
txt+= "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt+= "<p>Browser Language: " + navigator.language + "</p>";
txt+= "<p>Browser Online: " + navigator.onLine + "</p>";
txt+= "<p>Platform: " + navigator.platform + "</p>";
txt+= "<p>User-agent header: " + navigator.userAgent + "</p>";
txt+= "<p>User-agent language: " + navigator.systemLanguage + "</p>";

Try it yourself »



Navigator Object Reference Navigator Object



Ãâó: https://rainny.tistory.com/171?category=46527 [±àÁ¤Àû »ç°í¹æ½Ä^^]

Ãâó: https://rainny.tistory.com/171?category=46527 [±àÁ¤Àû »ç°í¹æ½Ä^^]