Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


<!-- index.html -->
<!doctype html>
<html class="no-js" lang="">
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Magic App</title>
    <meta name="description" content="Magic App">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="index.css">
    <h1>Magic App Here</h1>
    <div id="main">
        <div id="time" class="sub">
                <h2>Your local time</h2>
                <span class="local"></span>
                <h2>Magic App Server Time</h2>
                <span class="server"></span>
        <div id="location" class="sub">
            <h2>And you are in...</h2>
            <div class="address"></div>
    <!-- Script here -->


h1 {
  text-align: center
#main {
  max-width: 900px;
  display: table;
  margin-left: 30vw;
  margin-top: 10vh;

#main .sub {
  display: block;
  float: left;
  min-width: 300px;
  min-height: 300px;
  border: 0.5px solid #bbb;
  border-radius: 4px;
  padding: 15px;
#main .sub h2{
  font-size: 20px;
#main #time {
  margin-right: 5vw;

#main #time div {
  display: block;
  min-height: 120px;


document.addEventListener("DOMContentLoaded", function(event) {
  var address = document.querySelector('.address')
  if (!navigator.geolocation){
    console.log("Geolocation is not supported by your browser");
  } else {
    navigator.geolocation.getCurrentPosition(success, error);
function success(position) {
    var latitude  = position.coords.latitude;
    var longitude = position.coords.longitude;
    reverseGeocodingWithGoogle(longitude, latitude)
  function error() {
    console.log("Unable to retrieve your location");
  function ipLookup() {
    .then( res => res.json())
    .then(response => {
    .catch((data, status) => {
        address.innerText = 'We could not find your location'
function reverseGeocodingWithGoogle(latitude, longitude) {
    .then( res => res.json())
    .then(response => {
    .catch(status => {
function processUserData(response) {
    address.innerText = response.results[0].formatted_address
  function fallbackProcess(response) {
    address.innerText = `${}, ${}`
var localTime = jstz.determine().name();
  var serverTime = "Asia/Novosibirsk";
  document.querySelector('.server').innerText = new Date().toLocaleString("en-US", {timeZone: serverTime});
  document.querySelector('.local').innerText = new Date().toLocaleString("en-US", {timeZone: localTime});