Sunday, December 30, 2012

The mobile meta tag

    If you have ventured into the world of Mobile web development, you would have realized the importance of the viewport meta tag in the head section of your HTML page. Without the proper meta tag included in your HTML, your web page would zoom, move, be dragged around and basically not client acceptable. To avoid all of this, we need to include a viewport meta tag in the HTML in the head section.

    Jquery mobile suggests the users to use the following viewport meta tag.


<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0">

    By using the above viewport meta tag, the width would be set to pixel width of the device. This would avoid the resizing of the page and there-by the web page would not be draggable any more. However, this would not disable our zooming issue. The user can still zoom the web page by tapping the screen or by pinching it. Jquery mobile suggests that this is a feature that should be included, however, many a times, in most cases, this is not desirable. By using the above meta tag, your web page won't zoom when the device is in the Portrait mode, but when you change the orientation of the device the user can start zooming the web page. To avoid all of the above issues, the following meta tag should be used instead of the one suggested by Jquery Mobile.


<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">

    The user-scalable=no property disables the zoom feature of all the mobile devices in both the orientations. Hope this post helps a lot of web developers who are or would have faced this issue. Do share the post if it has helped you and you can follow the blog by liking the Spatial Unlimited page on Facebook.

If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Jquery Mobile - Single Page Structure

    We have been introduced to Jquery Mobile and have also seen some of the key features of the rich web framework in the previous posts. Today we will take a look at a general page structure using Jquery Mobile. So be ready to start off programming using Jquery Mobile.

    The Jquery Mobile page structure is optimized to support a single page or local, internally linked multiple pages. What does this mean? Well, single page architecture means, having multiple pages that are linked to each other using the normal process of using the anchor tag. So, each page will have its own header, content and footer. The multiple page structure is basically having multiple pages in one single page within different DIVs. So each page becomes a DIV which is linked to another page using an id for that particular page DIV.

    The multiple page architecture, though available is not popularly used because it results in a performance issue. The DOM becomes heavy as multiple pages load at the same time and the website becomes sloppy for the user. The multiple page architecture can be used for websites which are only content based with just 4-5 pages in it. However, for a decent enough website or an application, using the single page architecture makes more sense.

    If the above 2 paragraphs have not made any sense to you, do not get discouraged, take a look at the following to examples, and things will become much more clear.

Example #1:
    The following example shows a general structure of a page using Jquery Mobile. Take a look at the example, the code the result and I will explain the components of the code in further detail.



    You must have already taken a look at the example above. Let's begin with the important parts of the code first.
  • The HTML5 doctype - The HTML5 doctype has to be used to extract the maximum out of this framework. Any device with a browser that does not understand the HTML5 doctype ignores the doctype and custom Jquery Mobile attributes.
  • The viewport meta tag - The viewport meta tag tells the browser how the page zoom levels and dimensions are to be displayed. By setting the viewport attributes to content="width=device-width, initial-scale=1", the width will be set to the pixel width of the device screen. Now here, we are faced with an obvious question?
    • What happens if the viewport meta tag is not included?
      • In one line; your page would look bad. If the meta tag isn't set, many mobile browsers will use a "virtual" page width around 900 pixels to make it work well with existing desktop sites but the screens may look zoomed out and too wide.
    • However, there is a problem with the usage of this meta tag. The page still can be zoomed, and though Jquery Mobile says its a feature, many a times it is not desirable. To restrict the zooming of the browser, we need to use a more better and refined meta tag, the details of which you will find in this post.
  • Links to Jquery Mobile style-sheet and javascript files and the jquery javascript file.
    Let's come to the body of the code. You would have observed a few things like "data-role=page", "data-role=header", "data-role=content" and "data-role=footer". Inside the  tag, each view or "page" on the mobile device is identified with an element (usually a div) with the data-role="page" attribute. Although the page structure outlined above is a recommended approach for a standard web app built with jQuery Mobile, the framework is very flexible with document structure. The page, header, content, and footer data-role elements are optional and are mostly helpful for providing some basic formatting and structure.

UPDATE: The following example makes use of the next stable version of Jquery Mobile 1.3.1


    Here, we conclude our today's discussion on the Jquery Mobile Single Page structure. We would discuss the Multi-page structure in the further post. Including the multi-page structure in this post would make the post really lengthy and hence we will discuss this in the next post. Do let me know, if you have followed the post and also if you haven't, of any mistakes that you would have come across in this post.

    Hope you enjoy coding using Jquery Mobile and share this post if you have liked it. You can also follow the blog on Facebook by liking the Spatial Unlimited page.

If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Jquery Mobile Features

    The always improving and always progressing Jquery Mobile framework is currently in stable version 1.2.0. This version works with  versions of jQuery core from 1.7.0 to 1.8.2. Let's take a look at the various key features of this very powerful and truly cross-platform mobile web framework.

  1. Built on Jquery Core - This helps in consistency in syntax as it uses the standard Jquery syntax and makes use of the Jquery UI code and patterns. This also reduces the learning curve to a great extent due to the familiarity with Jquery.
  2. Compatible with all major mobile, tablet, e-reader & desktop platforms - This is probably one of the most important feature of this web platform. Jquery Mobile is compatible with a wide range of devices like iOS, Android, Blackberry, Palm WebOS, Nokia/Symbian, Windows Phone 7, MeeGo, Opera Mobile/Mini, Firefox Mobile, Kindle, Nook and all modern browsers with graded levels of support.
  3. Progressive enhancement approach brings core content and functionality to all mobile, tablet and desktop platforms and a rich, installed application-like experience on newer mobile platforms.
  4. Responsive design techniques and tools allow the same underlying codebase to automatically scale from smartphone to desktop-sized screens. This is very useful we have the same design for all device sizes like phones and tablets.
  5. Touch and mouse event support streamline the process of supporting touch, mouse and cursor focus-based user input methods with a simple API.
  6. Unified UI widgets for common controls enhance native controls with touch-optimized, themable controls that are platform-agnostic and easy to use.
  7. HTML5 Markup-driven configuration of pages and behavior for fast development and minimal required scripting.
  8. Powerful Ajax-powered navigation system to enable animated page transitions while maintaining back button, bookmarking and clean URLs through pushState. This feature comes in handy when the user has to bookmark pages on an e-commerce site or any other site for that matter. We as developers do not have to take extra efforts for bookmarking and back button functionality.
  9. Lightweight size and minimal image dependencies for speed. This proves really helpful as Jquery Mobile is used for devices which have a lesser computing speed as compared to our desktops and laptops.
  10. Modular architecture for creating custom builds that are optimized to only include the features needed for a particular application. This allows the application to be reduced in size even further.
  11. Accessibility features such as WAI-ARIA are also included to ensure that the pages work for screen readers (e.g. VoiceOver in iOS) and other assistive technologies. WAI-ARIA, the Accessible Rich Internet Applications Suite, defines a way to make Web content and Web applications more accessible to people with disabilities - users who rely on Screen Reders or users who cannot use the mouse. It especially helps with dynamic content and advanced user interface controls developed with Ajax, HTML, JavaScript, and related technologies.
    With all these features provided by the Jquery Mobile framework, the developers have a very strong platform on which they can build extensively branding based, customized and uniform applications across all devices and browsers.
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Jquery Mobile - Touch Optimized, Jquery and HTML5 based web framework

    Jquery Mobile - The next level of "Write Less, Do More" mantra of Jquery. Just recently, I started working on a project using the Jquery Mobile framework and just instantly fell in love with it! Jquery Mobile gives immense power and flexibility to developers and enables truly cross-platform and cross-browser and multi-device development. I have just loved it and have decided to share my knowledge with the readers of Spatial Unlimited.



    Jquery Mobile is a touch optimized web framework for smartphones and tablets. It's a unified, HTML5-based user interface system for all popular mobile device platforms, built on the rock-solid jQuery and jQuery UI foundation. Its lightweight code is built with progressive enhancement, and has a flexible, easily themeable design. This is one reason why I love Jquery Mobile. It is easily customizable - no head-ace of themeing; Jquery Mobile does it for you.

    Instead of writing unique apps for each mobile device or OS, the jQuery mobile framework allows you to design a single highly-branded web site or application that will work on all popular smartphone, tablet, and desktop platforms. This is another reason for the growing popularity of this web framework. Jquery Mobile takes care of all the cross-platform, OS specific issues and is continuously improving the support. Jquery Mobile has a very good developer community adding to the fast progress and device support for the same.

    Jquery Mobile has a wide range of UI widgets and elements, all following a fluid design, that we will be taking a look at in the following posts. I am on my learning curve and hope to take several along with me and on the way learn a lot from the many web-gurus here. Hope you like this new initiative from Spatial Unlimited and continue to show your support by sharing the knowledge, suggesting things and correcting me if I go wrong anywhere.
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Wednesday, December 19, 2012

Google Maps Santa Tracker


    While everyone is gearing up for Christmas, Google too is gearing up to spread the cheer with the world this Christmas. On Christmas Eve, Google will be showcasing a preview of Santa's dashboard - the technology that powers his sleigh during his around-the-world journey. Google has received this special preview from one of Santa’s many developer elves, who are hard at work in the North Pole helping Santa prepare for his big day.

    Santa’s dashboard - featuring the latest and the greatest in Google Maps technology and sleigh engineering - will allow all of us to follow his progress around the world, and also learn a little about some of his stops along the way.

    While Santa gets ready for his journey, we are all invited to visit and explore Santa's village. You are bound to find some fun activities and meet some interesting elves. Hope you all enjoy your visit to Santa's Village and let me know what did you enjoy the most - The Present Drop activity or the Present Jetpack activity or the elves at the Briefing section or the other elves at so many other places in the village.

    Wishing all the readers, merry Christmas and a very happy new year to come...



UPDATE:
    Santa is already on his way across the globe delivering gifts and presents to all the kids waiting eagerly for the big white beard Santa Claus. The Google Santa tracker allows you to view his journey around the world. Here are a few images from Santa's Dashboard.

 When Santa arrived at Omsk

 When Santa was on his way from Omsk to Pavlodar
 
Santa's Dashboard
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!

Tuesday, December 18, 2012

Where is Google Street View?

    Quite a number of people ask this - "Do you know where the Google Street View Cars are currently running?" "Which places have the Google Street View?" These question and so many similar questions are time and again asked on sites like Quora too. I was browsing through the stack of such questions and decided to look for an answer. I am sharing with you all, what I found from Google.

    Head to the Google link here and you will be able to see a map which shows the availability of the Google Street View images across the globe. Scroll down to the bottom and you will see a drop-down, where you can view the list of places in a particular country where the Google Street View cars are currently driving.

Google Map displaying the availability of Street View
    
    The blue overlay shows where Street View imagery is available. You can zoom in to an area to see more detail. The information shown in the "Where our cars are currently driving" section might not always be the most accurate. The reason being, many a times the cars might not be driving in the listed regions due to several unforeseen circumstances like weather, bad roads, etc. However, Google tries to maintain a most updated list at this site. Currently, as of December 18, 2012, the Google Street View cars are driving in the following regions of the United States.

 
    Hope I have answered a very common question among the Google Maps users and fans. If you have any other questions regarding the Google Maps, do write in the comment and I will try and answer those questions. If you have enjoyed this post, please take a moment to share it across your network.
If this post has helped you, leave a comment or show your love by liking the Spatial Unlimited Facebook page. You could even consider buying me a coffe! Till next time; happy coding!