Skip to content

Instantly share code, notes, and snippets.

@james-see
Created February 2, 2017 21:51
Show Gist options
  • Select an option

  • Save james-see/9b62fb8b55629d4add572818eefa818c to your computer and use it in GitHub Desktop.

Select an option

Save james-see/9b62fb8b55629d4add572818eefa818c to your computer and use it in GitHub Desktop.
redirect to onion if possible
<script type="text/javascript"> var onion = 'https://dua6u3dsufohrnsz.onion'; var query = new XMLHttpRequest(); if (window.location.protocol + "//" + window.location.hostname != onion) { query.onload = function(e) { if (query.status != 200) return else { window.location.assign(onion + window.location.pathname); } }; query.timeout = 5000; query.open('HEAD', onion, true); query.send(); }; </script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment