Skip to content

Instantly share code, notes, and snippets.

@prof3ssorSt3v3
Created August 8, 2017 21:41
Show Gist options
  • Save prof3ssorSt3v3/98c93160cc0535e21e7c9f3d2d46bd5f to your computer and use it in GitHub Desktop.
Save prof3ssorSt3v3/98c93160cc0535e21e7c9f3d2d46bd5f to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tha Internetz</title>
<meta name="viewport" content="width=device-width">
<style>
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
h1{
margin: 2rem;
}
#container{
margin: 2rem;
display:flex;
flex-flow: row wrap;
height: 402px;
width: 602px;
border: 1px solid #333;
}
.hour{
width:100px;
height: 100px;
padding: 10px;
border: 1px solid #333;
font-size: 3.6rem;
position: relative;
}
.hour span{
position: absolute;
bottom: 0;
right: 0;
left: 0;
color: #AAA;
font-size: 1.0rem;
text-align: center;
}
.precip{
background-color: hsl(200, 50%, 80%);
color: hsl(200, 50%, 40%);
}
.hot{
background-color: gold;
font-weight: bold;
}
</style>
</head>
<body>
<h1>Forecast for the Next 24 Hours</h1>
<main id="container">
</main>
<script src="./real-world.js"></script>
</body>
</html>
@FaizyQadri
Copy link

sir this error is coming i was tring to run this program on windows the api is not getting fetch
fetch API cannot load file:///D:/react-native/javaScript/darksky-sample.json. URL scheme must be "http" or "https" for CORS request.
init @ real-world1.js:15

@prof3ssorSt3v3
Copy link
Author

As it says in the error message, all fetch calls must be done over http(s). You can't load a script over file:/// with fetch.
You must run the script through a web server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment