milosev.com
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
      • Côte d'Azur 2024
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home

"ontouchstart" in document.documentElement Window 8 vs Window 7

Details
Written by: Stanko Milosev
Category: Chrome
Published: 23 February 2015
Last Updated: 18 August 2015
Hits: 6729

If you try, in Google Chrome under Windows 8, to execute following statement:

if ("ontouchstart" in document.documentElement) {
console.log("You can touch me")
} else {
console.log("Cant touch this")
}

or as jsLint recommends:

if (document.documentElement.ontouchstart !== undefined) {
console.log("You can touch me")
} else {
console.log("Cant touch this")
}

(document.documentElement.ontouchstart is null if it exists, that is why we have to compare it with undefined, just don't use hasOwnProperty because it seems that it doesn't work on Android devices)

return value will be true, in Windows 7 return value is false

Few more things which you can test:

iOS (iphone/ipad) console:

typeof window.Touch
"object"

Windows 8 VM, Chrome Stable console:

typeof window.Touch
"function"

OSX, Chrome Stable, Safari latest, console:

typeof window.Touch
"undefined"

Taken from here.

In order to disable touch events on google chrome go to:

chrome://flags/

search for:

Enable touch events Mac, Windows, Linux, Chrome OS

Choose disable.

Simple example of google maps

Details
Written by: Stanko Milosev
Category: HTML
Published: 05 January 2021
Last Updated: 05 January 2021
Hits: 2542
  • google maps
Here I want to have simplest example of google maps (in order to be able to copy paste it :) )
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <script defer type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=yourKey&callback=initMap"></script>
    <title></title>
</head>
<body>

    <div id="map-canvas"></div>

    <script>
        function initMap() {
            var mapCanvas = document.getElementById('map-canvas');
            var mapOptions = {
                zoom: 6,
                center: { lat: -34.397, lng: 150.644},
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };

            map = new google.maps.Map(mapCanvas, mapOptions);
        }
    </script>

<style>
    html, body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
    }

    #map-canvas {
        width: 100%; 
        height: 100%; 
    }
</style>

</body>
</html>

Twitter cards

Details
Written by: Stanko Milosev
Category: HTML
Published: 09 February 2020
Last Updated: 31 October 2022
Hits: 2810
To control how your web page will look on Twitter use Twitter cards. To check how your web page will look on the Twitter before actually posting it use Card validator.As of mid 2022, preview functionality was removed from the Card Validator 919.

One my example of Twitter cards:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">

<head>
	<meta content="text/html; charset=UTF-8" name="Content-Type" />
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:site" content="@milosev.com" />
    <meta name="twitter:creator" content="@stankomilosev" />
	<meta property="og:title" content="Test title" />	
    <meta property="og:url" content="http://www.milosev.com/gallery/allWithPics/india/www/index.html" />
    <meta property="og:image" content="http://www.milosev.com/gallery/allWithPics/india/thumbs/20191111_162437.jpg" />
    <meta property="og:description" content="Test description" />	
</head>

<body>
    test1
</body>

</html>
Here is test link.

Notice line:

	<meta content="text/html; charset=UTF-8" name="Content-Type" />
Without that line it will not work.

Facebook open graph

Details
Written by: Stanko Milosev
Category: HTML
Published: 15 September 2018
Last Updated: 24 October 2020
Hits: 3274
To control how your web page will look on Facebook use facebook open graph markup. To check how your web page will look on facebook before actually posting it use Open Graph Object Debugger Sharing Debugger.

One my example of facebook open graph:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">

	<head>
		<meta property="og:title" content="test" />
		<meta property="og:url" content="http://www.milosev.com/gallery/index.html" />
		<meta property="og:image" content="http://www.milosev.com/gallery/20180911_202614.jpg" />
		<meta property="fb:app_id" content="2128533190490272" />
		<meta property="og:description" content="Yo! This is a test!" />

	</head>
	
	<body>
	test
	</body>
	
</html>
  1. Responsive Images
  2. Wrap table row to the next line
  3. Async and defer
  4. Overlay

Subcategories

C#

Azure

ASP.NET

JavaScript

Software Development Philosophy

MS SQL

IBM WebSphere MQ

MySQL

Joomla

Delphi

PHP

Windows

Life

Lazarus

Downloads

Android

CSS

Chrome

HTML

Linux

Eclipse

Page 159 of 165

  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163