Found 2416 Articles for HTML

How to automatically redirect your visitors to your new home page?

Arjun Thakur
Updated on 25-Feb-2020 06:49:25

2K+ Views

Page redirection is a situation where you clicked a URL to reach a page X but internally you were directed to another page Y. It happens due to page redirection.To redirect from an HTML page, use the META Tag. With this, use the http-equiv attribute to provide an HTTP header for the value of the content attribute. The value in the content is the number of seconds; you want the page to redirect after.Through this, you can automatically redirect your visitors to a new homepage. Set the content attribute to 0, if you want it to load immediately.The following is ... Read More

How to add a YouTube Video to your Website?

Fendadis John
Updated on 16-Jun-2020 08:20:41

624 Views

To add a YouTube Video to your website, you need to embed it. To embed a video in an HTML page, use the element. The source attribute included the video URL. For the dimensions of the video player, set the width and height of the video appropriately.The Video URL is the video embed link. The video we will be embedding our example will be YouTube.To get the embed link, go to a YouTube Video and click embed as shown below. You will get a link fro embed here −You can try to run the following code to learn how ... Read More

How Server-Sent Events Works in HTML5?

Jai Janardhan
Updated on 25-Feb-2020 06:55:09

342 Views

Server-sent events standardize how we stream data from the server to the client. To use Server-Sent Events in a web application, you would need to add an element to the document.The src attribute of element should point to an URL which should provide a persistent HTTP connection that sends a data stream containing the events.The URL would point to a PHP, PERL or any Python script which would take care of sending event data consistently. Following is a simple example of web application which would expect server time.You can try to run the following code to learn how ... Read More

How to use SVG images in HTML5?

Paul Richard
Updated on 18-May-2020 08:29:55

4K+ Views

To use SVG images in HTML5, use element or . To add SVG files, you can use , or element in HTML. Choose any one of them according to your requirement.Here’s how you can add SVG images. If the SVG is saved as a file, it can be directly used as an SVG image:ExampleYou can try to run the following code to use SVG ImagesLive Demo                    #svgelem {             position: relative;             left: 50%;             -webkit-transform: translateX(-20%);             -ms-transform: translateX(-20%);             transform: translateX(-20%);          }             HTML5 SVG Image               HTML5 SVG Image          

How to use splash vector graphics on your Responsive Site?

Rishi Raj
Updated on 25-Feb-2020 07:27:10

147 Views

Graphics for your responsive site can make it slower, but balancing it with vector graphics can help in minimizing the bandwidth. Through this, amazing graphics work great on mobile site too. Generally, canvas and SVG is used for this purpose.Use HTML5 Scalable Vector Graphics (SVG) to create a design for multiple screen sizes, since it handles it perfectly. Easily present vector based line drawings and do not worry about the pixels on your device since the graphics created with SVG are resolution independent. It scales the result and looks great in the browser.Here, we will look how to work with ... Read More

How to use HTML5 Geolocation Latitude/Longitude API?

Rishi Rathor
Updated on 18-May-2020 08:28:23

560 Views

HTML5 Geolocation API lets you share your location with your favorite websites. A JavaScript can capture your latitude and longitude and can be sent to backend web server and do fancy location-aware things like finding local businesses or showing your location on a map.The geolocation APIs work with a new property of the global navigator object ie. Geolocation object.ExampleYou can try to run the following code to find the current location using the Geolocation API, with Latitude and Longitude coordinatesLive Demo                    function showLocation(position) {           ... Read More

How to use HTML5 localStorage and sessionStorage?

Nancy Den
Updated on 18-May-2020 08:00:52

383 Views

HTML5 introduced two mechanisms, similar to HTTP session cookies, for storing structured data on the client side and to overcome the following drawbacks.Cookies are included with every HTTP request, thereby slowing down your web application by transmitting the same data.Cookies are limited to about 4 KB of data. Not enough to store required data.The two mechanisms for storage are session storage and local storage and they would be used to handle different situations.Session StorageThe Session Storage is designed for scenarios where the user is carrying out a single transaction but could be carrying out multiple transactions in different windows at ... Read More

How to handle Geolocation errors in HTML5?

Krantik Chavan
Updated on 16-Jun-2020 07:37:10

749 Views

HTML5 Geolocation API lets you share your location with your favorite websites. A JavaScript can capture your latitude and longitude and can be sent to backend web server and do fancy location-aware things like finding local businesses or showing your location on a map.Geolocation is complicated, and it is very much required to catch any error and handle it gracefully.The geolocations methods getCurrentPosition() and watchPosition() make use of an error handler callback method which gives PositionError object. This object has following two properties −PropertyTypeDescriptionCodeNumberContains a numeric code for the error.messageStringContains a numeric code for the error.The following table describes the possible ... Read More

How to use geolocation coordinates in HTML5?

Nishtha Thakur
Updated on 14-May-2020 10:46:51

259 Views

HTML5 Geolocation API lets you share your location with your favorite websites. A Javascript can capture your latitude and longitude and can be sent to backend web server and do fancy location-aware things like finding local businesses or showing your location on a map. The geolocation coordinates specifies the geographic location of the device.Geolocation methods getCurrentPosition() and getPositionUsingMethodName() specify the callback method that retrieves the location information. These methods are called asynchronously to an object Position which stores the complete location information.The Position object specifies the current geographic location of the device. The location is expressed as a set of ... Read More

Why to use canvas tag in HTML5?

Nishtha Thakur
Updated on 15-Jun-2020 11:53:50

186 Views

Specifies height of the canvas.The HTML tag is used to draw graphics, animations, etc. using scripting. The tag introduced in HTML5.Let’s see a simple element with two specific attributes width and height along with all the core HTML5 attributes like id, name, and class etc.Here are the attributes −AttributeValueDescriptionheight pixelsSpecifies height of the canvas.width pixelsSpecifies width of the canvas.ExampleYou can try to run the following code to learn how to use canvas to create a rectangle. The canvas element has a DOM method called getContext, which obtains rendering context and its drawing functions. This function takes one ... Read More

Advertisements