Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<html>
<head>
<title>url max langth</title>
<script type="text/javascript">
(function() {
var urlLen = location.href.length;
location.hash.match(/l=(\d+)/);
var len;
if (len = RegExp.$1) {
len = len | 0;
if (len > 10000 * 100)
return alert('max length >= ' + len);
if (urlLen == len) {
len *= 2;
} else {
var l = (len / 2)|0;
len = l + ((l/4)|0);
if (len == urlLen) {
alert('max length = ' + len);
return;
}
}
} else {
len = 1000;
}
var url = location.href;
url = url.substr(0, url.indexOf(location.hash));
var q = '#l=' + len + '&';
var aLen = len - q.length - url.length;
var a = '';
for (var i = 0; i < aLen; i++) a+= 'a';
url += q + a;
location.href = url;
location.reload();
})();
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment