Internet Browser: Difference between revisions

Gamepad: Formatting and performance hint
Detect User Agent: Mobile site mode, misc. improvements
Line 884: Line 884:
=== Detect User Agent ===
=== Detect User Agent ===


To detect if the user agent is Nintendo 3DS Browser :
To detect if the user agent is the Nintendo 3DS Internet Browser (not including mobile site mode):


  <script type="text/javascript">
  <script type="text/javascript">
     if (navigator.userAgent.indexOf('Nintendo 3DS') == -1) { //If the UserAgent is not "Nintendo 3DS"
     if(navigator.userAgent.indexOf("Nintendo 3DS") == -1) { // If the user agent does not contain "Nintendo 3DS"
         location.replace('http://www.3dbrew.org'); //Redirect to an other page
         location.replace("http://www.3dbrew.org"); // Redirect to another page
     }
     }
  </script>
  </script>


* You can check <em>navigator.platform=="Nintendo 3DS"</em> as well.
* You can check using <code>navigator.platform.indexOf("Nintendo 3DS") > -1</code> as well.
* The New 3DS Internet Browser's "Request Mobile Sites" setting affects the user agent. To detect if the New 3DS Internet Browser is being used with this option enabled, use <code>screen.pixelDepth == 16 && navigator.platform == "iPhone"</code>.
** This relies on the fact that the internet browser renders its webpages in 16-bit color, which is (hopefully?) not possible with a real iPhone.
** Keep in mind that the previous browser-detection examples do not account for this setting.


=== Scrolling ===
=== Scrolling ===