Showing posts with label HTML5. Show all posts
Showing posts with label HTML5. Show all posts

Aug 4, 2016

HTML5 Mobile App - Open Google Play App

If I want to download and install a new app from Google Play I can use this:

<a href="market://details?id=" + appPackageName > Download this App </a>



  

Mar 12, 2016

Javascript pow() function

In Javascript if you want to rise a number to a power then you have to use one of the functions from Math module: Math.pow()

The Math.pow() function returns the base to the exponent power, that is, base exponent.

Syntax

Math.pow(base, exponent)

Parameters

base
The base number.
exponent
The exponent used to raise the base.

Description

Because pow() is a static method of Math, you always use it as Math.pow(), rather than as a method of aMath object you created (Math has no constructor).
Examples:
Math.pow(4,3);   // 4 * 4 * 4 = 48

Nov 9, 2015

HTML5 mobile app

I tried to develop an mobile app using HTML5 on Intel SDK. The app is quite ok on my old mobile phone a Samsung 6 years old. But on my actual phone which is an Nexus 5 the app has the font too small and the images are too small, as  well. So, I started to a lot of documentation on internet and I had to accumulate a lot of frustration with it. Nothing to help me, indeed. A lot of solutions consisting in modifying css to build 2 or 3 files for css just to increase the font when you have high density of pixels as for Retina display.
But, some of the solutions were with  viewport solution. But most of them haven't work for me.
And, after 3 day research I found something that helped me.

This page helped me: http://ariya.ofilabs.com/2011/08/mobile-web-logical-pixel-vs-physical-pixel.html
But they have something wrong in their code. So, I had to modify this to work well for me.

For Android, we apply the density DPI approach and now it becomes:
Here I had to modify like this:

2 maximum-scale=2 user-scalable=no”> 
And, also, I had to use this javascript function at onLoad body:
function schimbaPixelii(){
    var el, width, height;
    if (window.devicePixelRatio === 1) {
    if (window.innerWidth === 2 * screen.width ||
        window.innerWidth === 2 * screen.height) {
        el = document.getElementById('viewport');
        el.setAttribute('content', 'width=device-width, target-densityDpi=device-dpi ' +
            'initial-scale=1, maximum-scale=1, user-scalable=no');
        document.head.appendChild(el);
        width = window.innerWidth;
        height = window.innerHeight;
        if (width === 2 * screen.width) {
            width /= 2;
            height /= 2;
        }
    }
}
}

Sep 8, 2015

HTML5 vs HTML

There is some differences between HTML and HTML5. So though, we have:

HTML5 was designed to replace both HTML 4, XHTML, and the HTML DOM Level 2.
And XHTML is HTML + XML. For a better syntax and for a better administration they had to force HTML to be proper: for instance, if you open this tag <p> you have to close the tag with </p>.

The main goals of HTML5 are:
- Deliver rich content as graphics or movies without the need of additional plugins as Flash, for instance;
- Provide better semantic support for web page structure. For this, HTML5 introduces new structural element tags;
- Provide better cross-platform support (for PC browser, tablet or smartphone);
- Provide a stricter parsing standard to simplify error handling, ensure more consistent cross-browser behavior.

HTML5 has improved the support for embedding graphics, video and audio. For that HTML5 has some new tags: <canvas>, <audio>, <video>

HTML5 has introduced web workers. A web worker is a script that runs in the background, in another thread, without the page has to wait for it to complete. The visitor can continue to interact with the page while the web worker runs in the background.


HTML5 has new semantic tags to complement the structural logic of modern web applications. Here we have:
<main>
<nav>
<article>
<section>
<header>
<footer>
<aside>

HTML5 has new controls like
<calendar>
<date>
<time>
<email>
<url>
<search>



HTML5 has new extensions to the Javascript API as geolocation, drag-and-drop, storage and caching.