Archive

Archive for the ‘html5’ Category

iOS5 mobile safari changes and additions developers should be aware about

October 14th, 2011 1 comment

Mainly some notes for myself:
* utilizes HTTP Pipelining (Sends multiple requests on the same connection) to avoid round trip delays on servers that support them
* GPU accelerated rendering (for CSS transitions and such)
* “async” attribute for scripts now supported
* Loading of CSS scripts are now blocking
* HTML5 Web workers support
* CSS position: fixed
* CSS overflow: scroll (-webkit-overflow-scrolling: touch;)
* Still no browser based file upload (input type=”file”)
* new input types: date, datetime, month, time, range
* new EcmaScript 5 stuff

Categories: html5, iOS, iOS5, mobile development Tags:

Web app http request errors in iOS5 mobile safari caused by HTTP Pipelining?

October 14th, 2011 1 comment

iOS5 seams to have broken functionality in our HTML5 mobile webapp. Requesting audio media assets are currently failing 1 out of 2 times with one of two errors:

The operation couldn’t be completed. (NSURLErrorDomain error – 1013.)
The operation could not be completed

After much research I’ve come to the conclusion that our authenticated media host is having issues with the updated HTTP Request behavior in iOS5′s version of mobile Safari. iOS5 now uses its own flavor of HTTP Pipelining to speed up data transfer and my theory is somewhere along the line our host’s web server is disagreeing with it.

Since mobile networks usually have very high latency HTTP Pipelining allows the HTTP client to avoid round trips to the server by send multiple requests on the same connection without waiting for the server to respond. You can read up on iOS5′s version of HTTP Pipelining and the concept in general here:
http://www.blaze.io/mobile/ios5-top10-performance-changes/
http://www.blaze.io/mobile/http-pipelining-big-in-mobile/

We’ll be reaching out to our media content provider today to validate but I figured I would throw up a place for others experiencing the same issue to discuss as I am not seeing other posts about it yet.

Categories: html5, iOS, iOS5, mobile development Tags:

The IE6 silver bullet for HTML5 CSS3 Webapp development: Chrome Frame

October 11th, 2011 2 comments

Building javascript heavy webapps using html5 and css3 is tough when you have old but still stubbornly popular Internet Explorer browsers to support. The solution: Chrome Frame

In Google’s words:

Google Chrome Frame is an open source plug-in that seamlessly brings Google Chrome’s open web technologies and speedy JavaScript engine to Internet Explorer.

In my words: Hello IE 6 render my shit automagically using Chrome.

Once installed, this meta tag in your html will tell IE to use Chrome’s engine to render the document:

<meta http-equiv="X-UA-Compatible" content="chrome=1">

Don’t have Chrome Frame installed yet? These few lines of condition IE logic will check and prompt:

<!--[if IE]>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<style>
         .chromeFrameInstallDefaultStyle {
           width: 800px;
           border: 5px solid blue;
           z-index: 99999;
         }
        </style>

        <script>
         // The conditional ensures that this code will only execute in IE,
         // Therefore we can use the IE-specific attachEvent without worry
         window.attachEvent("onload", function() {
           CFInstall.check({
             mode: "inline", // the default
             oninstall: function(){
                 alert("Chrome Frame is now installed. You may need to restart your browser.");
             }
           });
         });
        </script>
<![endif]-->

Chrome Frame is installed at the user level if the user does not have admin access (Win!). The documentation states a restart isn’t even necessary once installed but I’ve found in my tests that the browser does need to be fully restarted so I’ve included a post-install alert specifying so in my code.

Forcing a user to install a plug-in to see content is usually a no-no but when it comes to all-or-nothing HTML5 CSS3 webapps that need to span all browsers an devices with a single codebase sometimes those IE6 users can use a little prodding. To clarify, Chrome the web browser does not have to be installed beforehand and installing the plug-in does not install the Chrome browser. Chrome Frame’s name is a bit of a misnomer as the structure of your document is not modified and no DOM frame is used–everything is just rendered beautifully even in IE6 using Chrome’s versions of the WebKit layout engine and V8 JavaScript engine via the IE plugin.

Categories: html5, mobile development Tags:

Fix self hosted ogg and webm videos not loading in Firefox html5 tags

August 13th, 2011 No comments

If your videos are not loading in Firefox with a 206 Partial Content check the Content Type returned in the response header for the file. If it reads text/plain your server isn’t passing the MIME type of the video. You should be able to create a .htaccess file in your video directory to fill in the missing MIME types. For example include this:

AddType video/ogg ogg
AddType video/webm webm

Categories: html5 Tags:

Add webm and ogg export options to Mac Quicktime

August 13th, 2011 No comments

For WebM support you can download the installer here.

For OGG dowload XiphQT.component from here and put it in your /Library/Components folder

Its worth noting that this will also add Webm and Ogg support to the html5 video tag in Safari.

Categories: html5, mac Tags:

convert gradient rotation into webkit’s css3 -webkit-gradient percentage based x and y pairs

March 28th, 2011 No comments

Webkit has extended their css3 gradient options with -webkit-linear-gradient which uses the standard “gradient rotation” value found in Mozilla’s -moz-linear-gradient but unfortunately this is only supported in Safari 5.1+ and Chrome 10+. Until Safari 5.1 becomes the norm any programmatic references to gradient rotation have to be converted from the typical 360 based rotation value to Webkit’s powerful but awkward (powerfully akward?)  -webkit-gradient point syntax where your linear gradient’s start and end values have to be defined as X,Y value pairs that explicitly state at what point the gradient starts and ends.

For a linear right-to-left gradient you could define percentage points like so:
-webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0, rgba(80,80,80,1)), color-stop(1, rgba(80,80,80,0.5)));
Which reads “start the gradient at wherever “0% width and 50% height” is and end the gradient at “100% width and 50% height”.

This is easy enough to calculate by hand but if you have a project with a ton of regular gradient rotation styles already defined you’re going to need to convert via javascript and some Trigonometry which is the situation I was in. A bit of googling turned up no clear cut method of converting a gradient rotation value to a pair of percentage based X and Y values so here is what I came up with. First the code:

function pointOnCircle(radius, angleInDegrees, origin){
var x = (radius * Math.cos(angleInDegrees * Math.PI / 180)) + origin.x;
var y = (radius * Math.sin(angleInDegrees * Math.PI / 180)) + origin.y;
return {x:x, y:y};
}

//webkit has updated syntax from -webkit-gradient to a much more sensible -webkit-linear-gradient with angle but
//this is only supported in Safari 5.1+ nd Chrome 10+ so we’ll have to do the math to convert gradient rotation to
//start and end points on a circle
var gradientRotation = 0 – (node.gradientRotation%360);
var centerPoint = {x:0, y:0};
var rotatedStartPoint = KickUtils.pointOnCircle(50, 180-gradientRotation, centerPoint);
var rotatedEndPoint = KickUtils.pointOnCircle(50, 360-gradientRotation, centerPoint);
rotatedStartPoint.x = Math.round(rotatedStartPoint.x+50);
rotatedStartPoint.y = Math.round(rotatedStartPoint.y+50);
rotatedEndPoint.x = Math.round(rotatedEndPoint.x+50);
rotatedEndPoint.y = Math.round(rotatedEndPoint.y+50);
return ‘background-image: -webkit-gradient(linear, ‘ + rotatedStartPoint.x+’% ‘+rotatedStartPoint.y+’%, ‘+rotatedEndPoint.x+”% “+rotatedEndPoint.y+’%, color-stop(0, …

Since a numeric gradient rotation value defines a gradient that passes through the center of a circle, you can use the trig function above to calculate the 2 points that line intersects the radius of the circle. Defining the center of the circle at 50, 50 you can get values returned in the -50 to +50 range. Add 50 to that value and tack on a % and voila your 2 percentage based points start and end values are defined.

Categories: html5 Tags: