I got sick of looking at links I posted with long URLs that spilled off the page, making things look untidy.
After looking around for a way to neatly wrap links without breaking them, I found this.
Now I can post links as long as I like, and this little piece of JavaScript will truncate the link text and preserve the URL. All you need is a little script in the head of your page:
Onload, the script will execute and rewrite the link as specified in shortlink.js:
// the maximum length of the links<br /> var mustlength=30;
... rewriting the link using the following function:
var newt=t.substr(0,mustlength/2)
+connector+
t.substr(t.length-mustlength/2-connector.length,t.length);
There are a load of other useful tools on both onlinetools.org and the author's site.
After looking around for a way to neatly wrap links without breaking them, I found this.
Now I can post links as long as I like, and this little piece of JavaScript will truncate the link text and preserve the URL. All you need is a little script in the head of your page:
<head>
<script type="text/javascript" src="shortlinks.js"> </script>
</head>
Onload, the script will execute and rewrite the link as specified in shortlink.js:
// the maximum length of the links<br /> var mustlength=30;
... rewriting the link using the following function:
var newt=t.substr(0,mustlength/2)
+connector+
t.substr(t.length-mustlength/2-connector.length,t.length);
There are a load of other useful tools on both onlinetools.org and the author's site.
0 comments:
Post a Comment
speak your mind, but keep it clean (the comment, not your mind).
no spam and no trolls please