JavaBeat

  • Home
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Privacy
  • Contact Us

HTML5 URL Input Type

March 22, 2014 by Krishna Srinivasan Leave a Comment

URL is another word for web address. URL stands for Uniform Resource Locator particularly used with HTTP. The web browsers request web pages from servers by using URL. In the web browsers, the URL of a webpage is displayed on top inside an address bar. It is an input field which contains absolute URL address on the World Wide Web.

Like type=”email”, browser will carry out some validations on these fields which carry the url input type and display error messages on form submission. URL string consists of three parts such as network protocol, host name and resource location. It includes forward slashes, periods, spaces and detecting domain such as .com, .net or .co.uk. It is supported by all the browsers such as Mozilla Firefox, Internet Explorer, Opera, Google Chrome, Safari etc. For example: http://www.google.com .

Syntax of url Input Type

[code lang=”html”]
<input type="url" name="some-name">
[/code]

HTML5 URL Input Type Example

[code lang=”html”]
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>URL Input Type</title>
</head>
<body>
<form>
<input type="url" name="website_address"
placeholder="Enter the Address" required="required">
<input type="Submit" value="submit">
</form>
</body>
</html>
[/code]

As shown in above program, we have used input type url which allows user to enter web address or URL in the address bar. The placeholderattribute specifies a short hint which describes value of the input field. The required attribute specifies an input field must be filled out before submitting the form.

HTML5 URL Demo

  • Save the file as url_example.html in your system.
  • Just open file in the browser, you will see the below picture in the browser. Note that the browser must support HTML5 specification.

After executing above program we will get following result.

HTML5 URL

HTML5 URL1

Filed Under: HTML Tagged With: HTML5

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Us

  • Facebook
  • Pinterest

As a participant in the Amazon Services LLC Associates Program, this site may earn from qualifying purchases. We may also earn commissions on purchases from other retail websites.

JavaBeat

FEATURED TUTORIALS

Answered: Using Java to Convert Int to String

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Copyright © by JavaBeat · All rights reserved