Skip to content

Instantly share code, notes, and snippets.

@Nomy
Created November 5, 2017 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nomy/c67c2baf6b732544dd003732676db838 to your computer and use it in GitHub Desktop.
Save Nomy/c67c2baf6b732544dd003732676db838 to your computer and use it in GitHub Desktop.
WebFix_V1.01 - redirect.html by Byte
<html>
<head>
<title>WebFix</title>
</head>
<body>
<script type="text/javascript">
function escapeHtml(text) {
return text
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}
function fetchUrlParams(url) {
var urlParams = {};
url.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) {
urlParams[$1] = $3;
}
);
return urlParams;
};
var urlToParse = window.location.href;
var params = fetchUrlParams(urlToParse);
var url = 'about:blank';
var width = screen.width;
var height = screen.height;
if (typeof params.url != 'undefined')
url = escapeHtml(decodeURIComponent(params.url));
if (typeof params.width != 'undefined' && params.width != 0)
width = escapeHtml(params.width);
if (typeof params.height != 'undefined' && params.height != 0)
height = escapeHtml(params.height);
window.open(url, "_blank", "width=" + width + ", height=" + height);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment