Welcome Guest! (App Version 3.1)

websitnero logo name

Cookies

Using Cookies in HTML5

Cookies have been used from long time to store data on the client browser. This is not exactly what comes in HTML5, but for consistency we have included this feature along with 4 other ways to store data on browser introduced in HTML5.

Look at the example below to see usage of cookies:

Example

<button onclick="alpha()">Click Me</button>

<script>

function alpha(){
  document.cookie="name=Peter Martin";
  document.cookie="city=New York";
}

</script>

Example

<button onclick="alpha()">Click Me</button>

<script>

function alpha(){
  var expDate = new Date();
  expDate.setMonth( expDate.getMonth() - 1 );
  
  document.cookie="name=Peter Martin5";
  document.cookie="city=New York";
  document.cookie="expires=" + expDate;
}

</script>
WebsiteNero is highly optimized for learning various website developing technlogies. We try our best to add maximum modules and examples to help learn the concepts clearly and vividly. We try to present all content and examples as simple as we can removing any complexity to hurdle easy understanding. We try best provide you with worthful content, but we cannot guarantee full correctness of all the content on this site. While using this website, you agree to have read and accepted all our terms of use and conditions, cookie, and privacy policy. Copyright, 2013-2018 by websitenero.com. All Rights Reserved.