123

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <body>
  <div class="page-header">
    <h1>HTML5 Javascript API <small> for enhanced Web App development - i-visionblog</small></h1>
  </div>
  <h4>Notification API - Notifies when new info arrives
</h4>
  <span class="label label-danger">Permission Required</span>
  <hr>
  <span>Click the button and provide permission</span>
  <br />
  <button onclick="notify()" class="btn btn-sm btn-danger">Notify Me</button>
  <hr>
  <h4>Location API - Gets Device Location INFO
</h4>
  <span class="label label-danger">Permission Required</span>
  <hr>
  <span>This API shares the location of the Device to the Site</span>
  <br />
  <button onclick="shareLocation()" class="btn btn-sm btn-warning">Share location info</button>
  <div id="out"></div>
  <hr>
  <h4>Offline access API - LocalStorage - JSON Strings</h4>
  <span class="label label-success">No Permission Required</span>
  <hr>
  <span>This allows you to store values as String and can be easily created and retrieved since it uses key,pair values to process.</span>
  <br /> name : Shivasurya
  <br /> company : i-visionblog
  <br />
  <button onclick="localstore()" class="btn btn-sm btn-success">Store the Values</button>
  <button onclick="retrieveStore()" class="btn btn-sm btn-info">Retrieve the value</button>
  <hr>
  <h4>Offline access API - Indexed Database</h4>
  <span class="label label-success">No Permission Required</span><span class="label label-danger">Check for compatability</span>
  <hr>
Read the Github Gist - <a href="https://github.com/SuyashMShepHertz/indexedDB_sample/blob/master/index.html">link</a>
  <hr>
  
</body>

</html>
            
          
!
            
              	body {
	  margin: 40px;
	  background-color: #004040;
	  color: white;
	}
            
          
!
            
              function notify() {
	  if (!("Notification" in window)) {
	    alert("This browser does not support desktop notification");
	  } else if (Notification.permission === "granted") {
	    var notification = new Notification("Hi there!");
	  } else if (Notification.permission !== 'denied') {
	    Notification.requestPermission(function(permission) {
	      if (permission === "granted") {
	        var notification = new Notification("Shiva has Messaged You!");
	      }
	    });
	  }

	}

	function shareLocation() {
	  var output = document.getElementById("out");
	  if (!navigator.geolocation) {
	    output.innerHTML = "<p>Geolocation is not supported by your browser</p>";
	    return;
	  }

	  function success(position) {
	    var latitude = position.coords.latitude;
	    var longitude = position.coords.longitude;

	    output.innerHTML = '<p>Latitude is ' + latitude + '° <br>Longitude is ' + longitude + '°</p>';

	    var img = new Image();
	    img.src = "https://maps.googleapis.com/maps/api/staticmap?center=" + latitude + "," + longitude + "&zoom=13&size=700x250&sensor=false";

	    output.appendChild(img);
	  };

	  function error() {
	    output.innerHTML = "Unable to retrieve your location";
	  };

	  output.innerHTML = "<p>Locating…</p>";

	  navigator.geolocation.getCurrentPosition(success, error);
	}

	function localstore() {
	  if (typeof(Storage) !== "undefined") {
	    // Code for localStorage/sessionStorage.
	    localStorage.setItem("name", "Shivasurya");
	    localStorage.setItem("company", "i-visionblog");
	    alert("saved the values");
	  } else {
	    // Sorry! No Web Storage support..
	    alert("Your Browser Doesnt Support Storage Feature");
	  }
	}

	function retrieveStore() {
	  alert(localStorage.getItem("company"));
	}


            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console