Skip to content

Instantly share code, notes, and snippets.

@marc-x-andre
Created January 18, 2019 16:44
Show Gist options
  • Save marc-x-andre/68ad2f6109ea3105b68956ad8aa315b4 to your computer and use it in GitHub Desktop.
Save marc-x-andre/68ad2f6109ea3105b68956ad8aa315b4 to your computer and use it in GitHub Desktop.
Small `Get` Url tester for CORS policy testing
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>CORS Tester</title>
<script>
sendRequest = () => {
const urlInput = document.getElementsByClassName("urlInput")[0];
const xhttp = new XMLHttpRequest();
xhttp.open("GET", urlInput.value, true);
xhttp.send("GET", urlInput.value, true);
};
</script>
<style>
body{height: 100vh;margin: 0;position: relative;flex-direction: column;}
input, button {zoom: 2;}
.urlInput {width: 30vw;}
.center {display: flex;justify-content: center;align-items: center;}
</style>
</head>
<body class="center">
<div class="center" style="flex-direction: column;">
<h1>Get Url Tester</h1>
<h3>Open the console, enter you url, click 'send'</h3>
</div>
<div class="center">
<input class="urlInput" type="url" value="https://" />
<button onclick="sendRequest()">Send</button>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment