Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Safe Browser and Fetch API
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
(function() {
let msg = document.createElement('p')
fetch('resource.json').then( (res) => {
return res.json()
}).then( (data) => {
msg.innerText = data.message
}).catch( (error) => {
msg.innerText = error.message
"message": "Hello World"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.