Changes

10,449 bytes added ,  22:39, 2 April 2023
m
Update link to ImageShare
Line 11: Line 11:  
The only difference between the ExeFS .code for each region of the Old3DS/New3DS browser, is byte values for the title uniqueID/region.
 
The only difference between the ExeFS .code for each region of the Old3DS/New3DS browser, is byte values for the title uniqueID/region.
   −
A [[#v9.9_dummy_web-browser|"dummy" browser]] (which replaces the actual browser) is being included with cartdrige games shipping the [[9.9.0-26|9.9.0-X]] system update.  
+
A [[#Dummy_web-browser|"dummy" browser]] (which replaces the actual browser) is being included with cartdrige games shipping with system updates starting with [[9.9.0-26|9.9.0-X]].  
 
In addition, versions of the real browser since 9.9.0-26X attempt to [[#Forced_system-update|check-in with a Nintendo server]] to determine if the existing browser version is out of date.
 
In addition, versions of the real browser since 9.9.0-26X attempt to [[#Forced_system-update|check-in with a Nintendo server]] to determine if the existing browser version is out of date.
   Line 25: Line 25:  
The New3DS browser uses the following services: [[MVD_Services|mvd:STD]] and [[IR_Services|ir:rst]](DLC-related services are used too but those aren't New3DS specific).
 
The New3DS browser uses the following services: [[MVD_Services|mvd:STD]] and [[IR_Services|ir:rst]](DLC-related services are used too but those aren't New3DS specific).
 
Video decoding is done with [[MVD_Services|mvd:STD]]. Audio decoding/playback is done with a browser-specific DSP binary. The Old3DS browser used CSND for audio playback, the New3DS browser doesn't have access to that at all since it uses DSP instead.
 
Video decoding is done with [[MVD_Services|mvd:STD]]. Audio decoding/playback is done with a browser-specific DSP binary. The Old3DS browser used CSND for audio playback, the New3DS browser doesn't have access to that at all since it uses DSP instead.
The browser manual includes licenses for Android and PacketVideo. The browser uses libstagefright from Android.
+
 
 +
=== Video / libstagefright ===
 +
The browser manual includes licenses for Android and PacketVideo. The browser uses libstagefright from Android. Just like WebKit, the browser appears to use a very old version of libstagefright with security/other changes back-ported(for example, the v10.7 browser libstagefright codebase seems to be older than [https://android.googlesource.com/platform/frameworks/av/+/ec77122351b4e78c1fe5b60a208f76baf8c67591%5E%21/media/libstagefright/MPEG4Extractor.cpp this]). This codebase is missing certain chunk-parsing code for 3GP.
 +
 
 +
HTTP for libstagefright is internally handled with [[HTTP_Services|HTTPC]], with a similar(?) set of RootCAs as for browser-version-check.
    
===User-Agent and Browser Versions===
 
===User-Agent and Browser Versions===
Line 31: Line 35:     
<region> can be one of the following: "JP", "US", or "EU".
 
<region> can be one of the following: "JP", "US", or "EU".
 +
 +
Mobile User-Agent is always <code>Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25</code>.
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 36: Line 42:  
! Mobile NintendoBrowser version(displayed in browser settings)
 
! Mobile NintendoBrowser version(displayed in browser settings)
 
! Normal UA
 
! Normal UA
! Mobile UA
   
! CDN Title-version
 
! CDN Title-version
 
! Network-only system-update version
 
! Network-only system-update version
Line 43: Line 48:  
| 1.0.9934
 
| 1.0.9934
 
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.8 Mobile NintendoBrowser/1.0.9934.<region>
 
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.8 Mobile NintendoBrowser/1.0.9934.<region>
| Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25
   
| v10
 
| v10
 
| [[9.0.0-20]]
 
| [[9.0.0-20]]
Line 50: Line 54:  
| 1.1.9996
 
| 1.1.9996
 
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.10 Mobile NintendoBrowser/1.1.9996.<region>
 
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.10 Mobile NintendoBrowser/1.1.9996.<region>
| Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25
   
| v1027
 
| v1027
 
| [[9.3.0-21]]
 
| [[9.3.0-21]]
Line 57: Line 60:  
| 1.2.10085
 
| 1.2.10085
 
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.13 Mobile NintendoBrowser/1.2.10085.<region>
 
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.13 Mobile NintendoBrowser/1.2.10085.<region>
| Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25
   
| v2051
 
| v2051
 
| [[9.6.0-24]]
 
| [[9.6.0-24]]
 
| See below.
 
| See below.
 
|-
 
|-
| None
   
| None
 
| None
 
| None
 
| None
Line 70: Line 71:  
|-
 
|-
 
| 1.3.10126
 
| 1.3.10126
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.15 Mobile NintendoBrowser/1.3.10126.US
+
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.15 Mobile NintendoBrowser/1.3.10126.<region>
| Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25
   
| v3077
 
| v3077
 
| [[9.9.0-26]]
 
| [[9.9.0-26]]
Line 77: Line 77:  
|-
 
|-
 
| 1.4.10138
 
| 1.4.10138
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.17 Mobile NintendoBrowser/1.4.10138.US
+
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.17 Mobile NintendoBrowser/1.4.10138.<region>
| Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25
   
| v4096
 
| v4096
 
| [[10.2.0-28]]
 
| [[10.2.0-28]]
 
| See below.
 
| See below.
 
|-
 
|-
|  
+
| 1.5.10143
|  
+
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.19 Mobile NintendoBrowser/1.5.10143.<region>
|
   
| v5121
 
| v5121
 
| [[10.4.0-29]]
 
| [[10.4.0-29]]
 
| See below.
 
| See below.
 
|-
 
|-
|  
+
| 1.6.10147
|  
+
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.19 Mobile NintendoBrowser/1.6.10147.<region>
|
   
| v6144
 
| v6144
 
| [[10.6.0-31]]
 
| [[10.6.0-31]]
 
| See below.
 
| See below.
 +
|-
 +
| None
 +
| None
 +
| v7168
 +
| v10.7 CUP
 +
| v10.7 CUP dummy web-browser, see below.
 
|-
 
|-
 
| 1.7.10150
 
| 1.7.10150
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.19 Mobile NintendoBrowser/1.7.10150.US
+
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.19 Mobile NintendoBrowser/1.7.10150.<region>
|
   
| v7184
 
| v7184
 
| [[10.7.0-32]]
 
| [[10.7.0-32]]
 +
| See below.
 +
|-
 +
| 1.8.10156
 +
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.20 Mobile NintendoBrowser/1.8.10156.<region>
 +
| v8192
 +
| [[11.1.0-34]]
 +
| See below.
 +
|-
 +
| None
 +
| None
 +
| v9217
 +
| v11.4 CUP
 +
| v11.4 CUP dummy web-browser, see below.
 +
|-
 +
| 1.9.10160
 +
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.20 Mobile NintendoBrowser/1.9.10160.<region>
 +
| v9232
 +
| [[11.4.0-37]]
 +
| See below.
 +
|-
 +
| 1.10.10166
 +
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.22 Mobile NintendoBrowser/1.10.10166.<region>
 +
| v10272
 +
| [[11.9.0-42]]
 +
| See below.
 +
|-
 +
| 1.11.10172
 +
| Mozilla/5.0 (New Nintendo 3DS like iPhone) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.0.5.23 Mobile NintendoBrowser/1.11.10172.<region>
 +
| v11264
 +
| [[11.14.0-46]]
 
| See below.
 
| See below.
 
|}
 
|}
    
Note that the latest Old3DS browser WebKit version at the time the initial New3DS browser was released, was the following: 532.8.
 
Note that the latest Old3DS browser WebKit version at the time the initial New3DS browser was released, was the following: 532.8.
 +
 +
The first version of the KOR New3DS browser was v9.6(which was when the New3DS KOR titles were originally added). Each version of the KOR browser has the same NintendoBrowser version as the other regions. The KOR browser has been only updated when the browser for the other regions were updated, hence the title-versions are the same as well. The KOR browser ExeFS .code is different from the other regions(more than just region-related IDs etc).
    
==== OSS 9.0 and 9.3 diff ====
 
==== OSS 9.0 and 9.3 diff ====
Line 320: Line 354:  
  applet
 
  applet
 
  2016-03-02 18:25
 
  2016-03-02 18:25
 +
 +
==== v11.1 ====
 +
The ExeFS codebin was updated. The following files in RomFS were updated:
 +
 +
  /build/buildinfo.dat
 +
  /.crr/static.crr
 +
  /oss.cro.lex
 +
  /static.crs
 +
  /webkit.cro.lex
 +
 +
  cat v8192/00000026_romfs/build/buildinfo.dat
 +
  10156
 +
  applet
 +
  2016-08-26 19:47
 +
 +
Minus the 4 functions that changed due to compiler optimization, only 1 function was actually updated. This is LT_1a4004, previous version at LT_1a4004: libstagefright status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth)
 +
 +
Additional code was added which doesn't seem to be from upstream git, right [https://android.googlesource.com/platform/frameworks/av/+/32d6e5f0ebe9e00f80401e5f4fd6e285a474590d/media/libstagefright/MPEG4Extractor.cpp#880 before] the cprt code block: "if((*offset + chunk_size) - data_offset < 0)fail"
 +
 +
This fixed skater31hax + any other mp4 haxx which requires using a negative 64bit chunk_size value.
 +
 +
The filepath base used in the assert strings were changed from "d:\Jenkins\workspace\MPSkaterBuild\MVPlayer\Skater\Base\Android\frameworks\base\media\libstagefright\" to "d:\jenkins\workspace\MPSkaterBuild-Git\Base\Android\frameworks\base\media\libstagefright\".
 +
 +
==== v11.4 ====
 +
The only changes in RomFS was for "/build/buildinfo.dat" and "/static.crs", hence no OSS in CRO(s) were updated.
 +
 +
The main codebin was updated. Exactly two functions were updated, these are not related to code exec vulns.
 +
 +
  cat v9232/00000027_romfs/build/buildinfo.dat
 +
  10160
 +
  applet
 +
  2017-03-08 19:44
    
=== New3DS Browser Specifications ===
 
=== New3DS Browser Specifications ===
Line 342: Line 408:     
MJPEG + .avi is also supported.
 
MJPEG + .avi is also supported.
 +
 +
==== Gamepad ====
 +
The browser's now-outdated gamepad API provides information about the states of the circle pad, C-stick, and every button aside from the Home and Power buttons. The gamepad, which has an ID of <code>New Nintendo 3DS Controller</code>, is contained within the array returned by the <code>navigator.webkitGetGamepads</code> function.
 +
 +
Both of the gamepad's arrays, which contain the states of various inputs, seem to be reconstructed each time they are accessed via their gamepad object. It is not known if the values within the arrays can update upon each access of the array, but the values <em>can</em> update frequently enough to obtain accurate readings of the system's controls.
 +
 +
===== Axes =====
 +
The gamepad's <code>axes</code> array contains four floating-point numbers in the following order:
 +
 +
{|class="wikitable" width="20%"
 +
! Index !! Axis
 +
|-
 +
| 0 || Circle pad X
 +
|-
 +
| 1 || Circle pad Y
 +
|-
 +
| 2 || C-stick X
 +
|-
 +
| 3 || C-stick Y
 +
|}
 +
 +
Each coordinate ranges from -1.0 (left/up) to 1.0 (right/down). Neutral position is indicated by 0.0. Drift and/or inaccurate calibration may make these exact values unattainable.
 +
 +
===== Buttons =====
 +
The gamepad's <code>buttons</code> array contains numbers for the following numbers:
 +
{|class="wikitable" width="20%"
 +
! Index !! Button
 +
|-
 +
| 0 || B
 +
|-
 +
| 1 || A
 +
|-
 +
| 2 || Y
 +
|-
 +
| 3 || X
 +
|-
 +
| 4 || L
 +
|-
 +
| 5 || R
 +
|-
 +
| 6 || ZL
 +
|-
 +
| 7 || ZR
 +
|-
 +
| 8 || Select
 +
|-
 +
| 9 || Start
 +
|-
 +
| 10 || Unused
 +
|-
 +
| 11 || Unused
 +
|-
 +
| 12 || Up
 +
|-
 +
| 13 || Down
 +
|-
 +
| 14 || Left
 +
|-
 +
| 15 || Right
 +
|}
 +
 +
Each button's value is 0 while the button is not pressed, and 1 while the button is pressed.
 +
 +
Based on the Gamepad API's specifications, buttons 10 and 11 are reserved for left stick presses and right stick presses respectively, which the 3DS does not support.
 +
 +
==== Notes ====
 +
* Viewport information can be specified with the <meta> element.
 +
* The html "color" <input> type is not supported.
 +
* 3D images appear as their right-eye image within webpages.
 +
* Webpages are locked to the bottom screen when zooming is disabled, the webpage's initial scale is 1, and the entire webpage can fit within the bottom screen's dimensions (320x212).
 +
* Interactable elements that are positioned partially outside of the bottom screen can temporarily be moved further inside the bottom screen by tapping them with the touchscreen.
 +
* Favicons can be changed using Javascript, but they become unchangeable once the document's <em>readystatechange</em> event finishes firing with a ready state of "complete".
 +
* Focusing on text-editable elements via Javascript will always open the keyboard.
 +
* Webpage content is usually rendered at 30 FPS despite the <code>webkitRequestAnimationFrame</code> function allowing code to run at a rate of 60 FPS.
 +
** As a result, display-related routines may only show half of their intended updates.
 +
** This issue can be mitigated by rendering on every other frame. However, various factors (such as touchscreen input and sleep mode) make this fairly inconsistent.
    
== Old3DS browser ==
 
== Old3DS browser ==
Line 350: Line 492:  
* "User agent: Mozilla/5.0 (Nintendo 3DS; region; ; en) Version/1.7498.US"
 
* "User agent: Mozilla/5.0 (Nintendo 3DS; region; ; en) Version/1.7498.US"
 
* "Supported protocols: HTTP1.0/HTTP1.1/SSLv3/TLS1.0"
 
* "Supported protocols: HTTP1.0/HTTP1.1/SSLv3/TLS1.0"
* "Web standard: HTML 4.01/XHTML 1.1/CSS 1/CSS 2.1/CSS 3 (partial functionality)/DOM Levels 1-3/ECMAScript
+
* "Web standard: HTML 4.01/XHTML 1.1/CSS 1/CSS 2.1/CSS 3 (partial functionality)/DOM Levels 1-3/ECMAScript/XMLHttpRequest/Canvas Element (partial functionality)"
/XMLHttpRequest/Canvas Element (partial functionality)"
   
* "Image format: MPO / GIF / JPEG / PNG / BMP / ICO (some images cannot be displayed)"
 
* "Image format: MPO / GIF / JPEG / PNG / BMP / ICO (some images cannot be displayed)"
 
* "Plug-ins: Plug-ins such as Adobe Flash are not supported"
 
* "Plug-ins: Plug-ins such as Adobe Flash are not supported"
Line 382: Line 523:  
| [[4.0.0-7]]
 
| [[4.0.0-7]]
 
| ExeFS .code was updated, both of the CROs(webkit/OSS) were updated too. The manual CFA was updated as well.
 
| ExeFS .code was updated, both of the CROs(webkit/OSS) were updated too. The manual CFA was updated as well.
 +
|-
 +
| 1.7538
 +
| v0
 +
| [[4.2.0-9]]
 +
| First version of the KOR browser. The CROs are different from the  USA/EUR/JPN [[4.0.0-7]] browser.
 
|-
 
|-
 
| 1.7552
 
| 1.7552
Line 427: Line 573:  
| See below.
 
| See below.
 
|-
 
|-
|  
+
| 1.7622
 
| v8192
 
| v8192
 
| [[10.6.0-31]]
 
| [[10.6.0-31]]
 
| See below.
 
| See below.
 
|-
 
|-
|  
+
| None
 +
| v9216
 +
| v10.7 CUP
 +
| v10.7 CUP dummy web-browser, see below.
 +
|-
 +
| 1.7625
 
| v9232
 
| v9232
 
| [[10.7.0-32]]
 
| [[10.7.0-32]]
 +
| See below.
 +
|-
 +
| 1.7630
 +
| v10240
 +
| [[11.1.0-34]]
 +
| See below.
 +
|-
 +
| 1.7636
 +
| v11297
 +
| [[11.9.0-42]]
 +
| See below.
 +
|-
 +
| 1.7639
 +
| v12288
 +
| [[11.14.0-46]]
 
| See below.
 
| See below.
 
|}
 
|}
 +
 +
=== Heap ===
 +
The USA/EUR/JPN + KOR browser allocates the 0x08000000 heap with size 0x01A97000. The size used by the CHN and TWN browser is 0x01997000, exactly 0x100000-bytes smaller.
    
=== Old3DS v9.9 ===
 
=== Old3DS v9.9 ===
Line 578: Line 747:  
=== Old3DS v10.7 ===
 
=== Old3DS v10.7 ===
 
''Nothing'' changed except some words for version-values in .text being updated(RomFS wasn't changed), code for browser-version-check was [[#v10.7_2|updated]].
 
''Nothing'' changed except some words for version-values in .text being updated(RomFS wasn't changed), code for browser-version-check was [[#v10.7_2|updated]].
 +
 +
=== Old3DS v11.1 ===
 +
Nothing changed in the ExeFS codebin besides the usual version values. The following files in RomFS were updated:
 +
  /cro/oss.cro
 +
  /cro/webkit.cro
 +
  /.crr/static.crr
    
== Forced system-update ==
 
== Forced system-update ==
Line 651: Line 826:  
The only actual code change with Old3DS/New3DS browser v10.7 was that the code which calculates the diff_timestamp was moved to immediately after the block which initializes <state_timestamp> when <state_timestamp> is all-zero. This fixed the browser-version-check [[3DS_Userland_Flaws|bypass]].
 
The only actual code change with Old3DS/New3DS browser v10.7 was that the code which calculates the diff_timestamp was moved to immediately after the block which initializes <state_timestamp> when <state_timestamp> is all-zero. This fixed the browser-version-check [[3DS_Userland_Flaws|bypass]].
   −
== v9.9 dummy web-browser ==
+
== Dummy web-browser ==
The gamecard v9.9 sysupdate included with some games contains a dummy Old3DS/New3DS web-browser. The *only* thing this title does is display the same message listed in the above forced-update section. The message files in RomFS *only* contain that message string above. There are no "http" strings in the main codebin, and [[RO_Services|RO]] isn't used either(no CRO data in RomFS at all). Both browsers are internally called "dummySpider".
+
Gamecards v9.9 and above include, with their sysupdate, a dummy Old3DS/New3DS web-browser. The *only* thing this title does is display the same message listed in the above forced-update section. The message files in RomFS *only* contain that message string above. There are no "http" strings in the main codebin, and [[RO_Services|RO]] isn't used either(no CRO data in RomFS at all). Both browsers are internally called "dummySpider".
   −
Hence, if you update your system from pre-v9.9 using a gamecard with v9.9, the system web-browser will be rendered *completely* useless until you install a system-update from CDN(no network requests involved here).
+
Hence, if you update your system below v9.8 with any v9.9 or above gamecard, the system web-browser will be rendered *completely* useless until you install a system-update from CDN(no network requests involved here).
 +
 
 +
Gamecards v10.7 and v11.4(New3DS only) have updated the dummy web-browser, where the only difference is the title version.
    
== Savedata ==
 
== Savedata ==
Line 689: Line 866:  
| s64 timestamp, can be either a normal positive timestamp or a relative negative one. Used with the forced-update described above. When an update is detected this timestamp is negative, otherwise this is a normal positive timestamp(it's unknown how exactly this timestamp is checked). When positive, this seems to be the last time the forced-update HTTPS request was done where no update was needed.
 
| s64 timestamp, can be either a normal positive timestamp or a relative negative one. Used with the forced-update described above. When an update is detected this timestamp is negative, otherwise this is a normal positive timestamp(it's unknown how exactly this timestamp is checked). When positive, this seems to be the last time the forced-update HTTPS request was done where no update was needed.
 
|}
 
|}
 +
 +
==APT Parameters==
 +
The URL to load can optionally be loaded from char[] string [[APT:SendParameter|paramblk+0]]. This is used when scanning URL QR-codes in Home Menu / etc.
    
==Errors==
 
==Errors==
Line 700: Line 880:  
  <input type="file" />
 
  <input type="file" />
 
* HTML5Test.com say that Drag and drop is supported but it's not (code on WebKit is ready, but it's not implemented on interface of browser)
 
* HTML5Test.com say that Drag and drop is supported but it's not (code on WebKit is ready, but it's not implemented on interface of browser)
 +
* Webpages are rendered with the RGB565 color format.
    
==Tips==
 
==Tips==
Line 705: Line 886:  
=== 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 ===
Line 743: Line 927:     
The events cannot have their default action cancelled.  Other buttons do not trigger key events.
 
The events cannot have their default action cancelled.  Other buttons do not trigger key events.
 +
 +
The Old3DS browser dispatches a <em>keypress</em> event once per key press for each of the buttons above, but the New3DS browser dispatches the event continuously until the button is released.
 +
 +
A keyboard event's <code>keyIdentifier</code> property usually should not be used to identify which button was pressed, as the A button's <em>keypress</em> event is dispatched with a key identifier of "" (an empty string) rather than "Enter" in the New3DS browser.
 +
 +
The New3DS browser's keyboard dispatches <em>keydown</em> and <em>keyup</em> events when a key is pressed, but it is not possible to determine which key was pressed based on the event itself. Every keyboard <em>keydown</em> event has a key code of 229 and a key identifier of "U+00E5", and every <em>keyup</em> event has a key code of 0 and a key identifier of "U+0000".
 +
 +
Key events are suppressed while the touchscreen is touched.
    
==== Touch/Mouse Events ====
 
==== Touch/Mouse Events ====
<em>onmousedown</em>, <em>onmouseup</em> & <em>onclick</em> are all triggered by the browser.  However, the <em>onmousedown</em> event doesn't trigger until you lift the stylus or you've held it on the screen for ~2 seconds—which is when text selection mode is activated—making it pretty much the same as <em>onmouseup</em>. The events cannot have their default action cancelled.
+
The <em>mousedown</em>, <em>mouseup</em>, and <em>click</em> events are all triggered by the browser.  However, the <em>mousedown</em> event doesn't trigger until you lift the stylus or you've held it on the screen long enough to trigger text selection mode.  Text selection mode requires pressing the touchscreen for approximately 1.05 seconds in the Old3DS browser, or pressing the touchscreen for approximately 0.41 seconds in the New3DS browser. Also, the <em>mousedown</em> event is only dispatched while text selection mode is active. Mouse events cannot have their default actions cancelled.
 +
 
 +
Touch events are not supported in the Old3DS browser, and the <em>touchcancel</em> event does not seem to be used by either browser. Touches cannot start within the bottom browser bar, but they can move to be within it. The rotation angle, contact radii, and pressure of each touch are always zero, as the 3DS touchscreen is not capable of detecting these values. Only one touch can be detected at a time due to the touchscreen's hardware limitations as well. Unlike mouse events, touch events can have their default actions cancelled. Doing so will prevent the touchscreen from being used to scroll through the webpage, highlight text, zoom out, and interact with the bottom browser bar.
   −
The <em>onmousemove</em> and common touch/gesture events are not supported.
+
==== System Font Characters ====
 +
The [[System_Font#Unicode_Private_Use_characters|system font]]'s private-use characters can be viewed within the web browser.
    
== Screen Resolution ==
 
== Screen Resolution ==
   −
The up screen resolution is 400×240. However, the viewable area in the browser is only <b>400×220</b>.
+
The up screen resolution is 400×240. However, the viewable area in the browser is only <b>400×215</b>.
   −
The touch screen resolution is 320×240. However, the viewable area in the browser is only <b>320×212</b>.
+
The touch screen resolution is 320×240. However, the viewable area in the browser is <b>320×212</b> <em>or</em> <b>320×240</b>, depending on if the bottom browser bar is visible. The New3DS browser's bottom bar can hidden by scrolling and/or attempting to zoom in/out with the C-stick, unless scrolling and zooming have both been disabled.
   −
You can have a page span both screens. However, the browser will behave as if the bottom screen is the only active screen and the top screen is scrolled off. This is important when computing CSS coordinates. Items positioned from "bottom" will be positioned based on 220px and not the full 432px of both screens.
+
You can have a page span both screens. However, the browser will behave as if the bottom screen is the only active screen and the top screen is scrolled off. This is important when computing CSS coordinates. Items positioned from the "bottom" will be positioned based on the height of the bottom screen, not the cumulative height of both screens.
    
== Using Both Screens ==
 
== Using Both Screens ==
Line 764: Line 959:  
  <html>
 
  <html>
 
   <head>
 
   <head>
     <meta name="viewport" content="width=400">
+
     <meta name="viewport" content="width=400, initial-scale=1">
 
     <style>
 
     <style>
       body{margin:0px;}
+
       body { margin: 0px; }
       #topscreen{width:400px;height:220px;overflow:hidden;}
+
       #topscreen { width: 400px; height: 215px; overflow: hidden; background-color: red; }
       #bottomscreen{width:320px;height:212px;overflow:hidden;margin:0 auto;}
+
       #bottomscreen { width: 320px; height: 212px; overflow: hidden; background-color: blue; margin: 0 40px 28px; }
 
     </style>
 
     </style>
 
   </head>
 
   </head>
Line 779: Line 974:  
This scheme allows the page to be easily manipulated through JavaScript.  In order to have the window snap to the correct position, use the following JavaScript code:
 
This scheme allows the page to be easily manipulated through JavaScript.  In order to have the window snap to the correct position, use the following JavaScript code:
   −
  window.setInterval(function () {
+
  window.setInterval(function() {
     window.scrollTo(40, 220);
+
     window.scrollTo(40, 215);
  }, 50);
+
  }, 0);
   −
This automatically resets the position if the user accidentally scrolls the page.
+
This automatically resets the position if the user accidentally scrolls the page. Zooming should probably also be disabled by adding <code>user-scalable=no</code> to the <meta> viewport element, though this will only have an effect in the New3DS browser.
    
==Example Sites==
 
==Example Sites==
 
<!-- If you have a website that demonstrates these techniques, place it here! -->
 
<!-- If you have a website that demonstrates these techniques, place it here! -->
* [http://www.nintendo.com/3ds/internetbrowser/bookmarks Nintendo 3DS Bookmarks] - This is the first bookmark pre-installed in the browser.
+
* [http://www.nintendo.com/3ds/internetbrowser/bookmarks Nintendo 3DS Bookmarks]: This is the first bookmark pre-installed in the browser.
 +
* [http://theimageshare.com ImageShare]: Image uploader for the 3DS ([https://github.com/corbindavenport/imageshare source code])
 
* [http://3ds.andysmith.co.uk/jFox.html jFox] (Short URL: http://bit.ly/iB7FqW)
 
* [http://3ds.andysmith.co.uk/jFox.html jFox] (Short URL: http://bit.ly/iB7FqW)
* [http://ditto3d.com/3ds Ditto3D] (Short URL: http://bit.ly/oVreWA)
+
* [http://ditto3d.com/3ds Ditto3D (Dead Link)] (Short URL: http://bit.ly/oVreWA)