<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.18.2/URI.min.js"></script>
</head>
<body>
<h1>Open browser console to see console.log results.</h1>
<p><a href="https://tools.ietf.org/html/rfc6749#section-3.1.2">RFC 6749, The OAuth 2.0 Authorization Framework</a> </p>
<p><a href="https://tools.ietf.org/html/rfc3986#section-4.3">RFC 3896, Uniform Resource Identifier (URI): Generic Syntax</a></p>
<script>
function isAbsoluteUri(str) {
var uri = new URI(str);
return uri.is('absolute');
}
console.log('/myfolder/test.txt');
console.log(isAbsoluteUri('/myfolder/test.txt'));
console.log('~/myfolder/test.txt');
console.log(isAbsoluteUri('~/myfolder/test.txt'));
console.log('?hello=world');
console.log(isAbsoluteUri('?hello=world'));
console.log('https://example.com');
console.log(isAbsoluteUri('https://example.com'));
console.log('https://example.com/auth');
console.log(isAbsoluteUri('https://example.com/auth'));
console.log('ftp://example.com');
console.log(isAbsoluteUri('ftp://example.com'));
console.log('mailto:mail@example.com');
console.log(isAbsoluteUri('mailto:mail@example.com'));
console.log('com.example.bungieauth:oauth2redirect');
console.log(isAbsoluteUri('com.example.bungieauth:oauth2redirect'));
console.log('myapp:/oauth');
console.log(isAbsoluteUri('myapp:/oauth'));
</script>
</body>
</html>
## Simple Absolute URI tester using URI.js
Just edit the script in the index.html body and go to Preview