IPhone making Web pages for the 3 g 2

It – Hardware & Software | | 0 views

Continue to the last iPhone try pressing the point to make a Web page for the 3 g. Around this time limitations for checking and debugging is.

Limitations

iPhone is like are limitations you should know when making Web pages for the 3 g. Because the limit is 3 G (iPhone OS2) changed there is caution.

  • The decoded image sizes in GIF, PNG, TIFF image size up to 2 megapixels.
  • JPG images to decode by subsampling pixels smaller 1/16, because the original size up to maximum 32 M pixel.
  • Animated GIFS are up to 2 megapixels.
  • the canvas element, up to 2 megapixels. Must specify the size of 150 x 300 pixels.
  • Resources are downloaded, regardless of HTML, CSS, JavaScript, or non-an’s all less than 10 MB
  • JavaScript execution time is less than 10 seconds (less than 5 seconds OS1.1.4 old 3 G iPhone in)
  • Cannot use Flash and Java applets, SVG, WML (you can use a canvas).
  • By default, blocks pop-up Windows (can be changed in settings)
  • Page 8 page ( 8 window open and the equivalent ) limit allowed for open
  • window.showModalDialog() window.print() is not available.
  • Cannot use mouse hover and Mouse-over events are not so.
  • ToolTips also cannot be used as well.
  • Installing the plugin is not.
  • Download and the file upload is not allowed.
  • Custom x.509 certificate is not supported.
  • You must properly set the picture size. For example, don’t use 100 × 100 image img element for the 10 x 10.
  • Tiles of small image to the background (background), don’t use big images.

Let’s try JavaScript-related limitations a little really in this.

First, there is a run-time test of JavaScript.

JavaScript run-time test

Test execution time JavaScript was the limitations of the previous page.

JavaScript execution time is less than 10 seconds from the iPhone OS 2.0 was less than five seconds in the previous 3 G iPhone OS n/a Avoids situations end up endlessly by this JavaScript to stop iPhone features.

Try running script become an infinite loop while I tried. This is a code like the following. <script> window.addEventListener(“load”, function (event) {var strt =document.getElementById(“strt”); var stop =document.getElementById(“stop”); strt.innerHTML= “start:” + new Date(); While (true) {stop.innerHTML= “stop:” + new Date();};}, false); </script> Is the code becomes the processing of neverending endlessly true, because expression of the while loop. Shimatsu and freezes in normal browser (do not use in the General Web page), the following screen is results tested on iPhone 3 g.

Stopping after 10 seconds after the start. That, and it is safe.

However, you can see safety considerations are more than 10 seconds is all that useless? I tried running the comeback process of setTimeout and setInterval due workout.

Following code is tried. <script> window.addEventListener(“load”, function (event) {var cnt = 0; var timer =document.getElementById(“timer”); var msg =document.getElementById(“msg”); setInterval (function() {timer.innerHTML=(cnt++)+ “seconds”; msg.innerHTML+=’ | ‘; }, 1000); }, false); > the </script> < div id = “timer” >< will >< div id = “msg” >< will every 1000 milliseconds, seconds and “|” Script to export to the div element. The result is the following screen.

Now even many minutes work. However, auto-lock clues in the number of minutes specified in the course settings and leave for a while and stops. “That is not the ordinary JavaScript being stopped in 10 seconds so a mean, peace of mind.

Interesting is mean stop lock, incidentally, unlocked, is just a script will start the place stopped. This script takes works just like the pause with a stop watch. Also when the page move button also like start / stop and pause.

In the next page, try the debugging console useful for iPhone Web page development time.

iPhone debugging console

Safari for the iPhone about the special debug console. However, by default does not work, so need to have.

Steps are as follows:

Select the “settings” icon.

Select “Safari”.

Select the “Developer”.

Select “debug console”.

Launch the Safari looks like this after the console bar will appear.

When you tap this bar, open a message similar to the following.

Message is so displays along with the line number of the Tip and warning to the HTML, JavaScript, and CSS, when developing a useful tool.

Try the methods in JavaScript output messages to this console in the next page.

Make a console message

You can output from JavaScript using the method of the Console object to object immediately beneath the Window this message also.

Method can be used as follows:

Method Features
Console.log Outputs the string argument of the log
Console.warn Outputs the string argument with a warning icon
Console.error Outputs the string argument with the error icon
Console.info Outputs the string argument of the log (same as log)

Sample source for each method and the output is as follows:
“test console.log < script content =”text/javascript”> console.log(“); </script>

“test console.warn < script content =”text/javascript”> console.warn(“); </script>