Line 84: |
Line 84: |
| | | |
| === Detect User Agent === | | === Detect User Agent === |
− |
| |
| To detect if the user agent is Nintendo DSi Browser : | | To detect if the user agent is Nintendo DSi Browser : |
− |
| |
| <script type="text/javascript"> | | <script type="text/javascript"> |
− | window.onload=function() | + | window.onload=function |
− | {
| |
− | if (navigator.userAgent.indexOf('Nintendo DSi') == -1) //If the UserAgent is not "Nintendo DSi"
| |
− | {
| |
− | location.replace('http://www.dsibrew.org'); //Redirect to an other page
| |
− | }
| |
− | }
| |
− | </script>
| |
| | | |
| === Key Codes === | | === Key Codes === |
Line 124: |
Line 115: |
| | | |
| In vertical mode, 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 176px and not the full 352px of both screens. | | In vertical mode, 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 176px and not the full 352px of both screens. |
| + | |
| + | == Using Both Screens == |
| + | |
| + | Here's how your webpage can span both screens: |
| + | |
| + | # Use the meta tag to set vertical mode |
| + | # Ensure that your page takes up exactly 240x352 pixels. |
| + | # Add the following JavaScript just before the </body> tag: |
| + | |
| + | <script type="text/javascript">document.body.scrollTop = 176;</script> |
| + | |
| + | Generally the easiest way to accomplish the correct layout is to create HTML elements that "contain" the top and bottom screens. Here's an example: |
| + | |
| + | <html> |
| + | <head> |
| + | <meta name="viewport" content="width=240" /> |
| + | <style type="text/css"> |
| + | body { margin: 0px; } |
| + | #topscreen, #bottomscreen { width: 240px; height: 176px; overflow: hidden; } |
| + | </style> |
| + | </head> |
| + | <body> |
| + | <div id="topscreen">Top Screen</div> |
| + | <div id="bottomscreen">Bottom Screen</div> |
| + | </body> |
| + | </html> |
| + | |
| + | This scheme allows the page to be easily manipulated through JavaScript. |
| | | |
| == Example Sites == | | == Example Sites == |