简体   繁体   中英

URL Shortener Bookmarklet

well I've got a URL shortener, http://shrt.in/ and I thought of having a bookmarklet feature for it.

I've got one already, I haven't put it up on my site though, because I need to make it better.

Here's the one I have now :

javascript:location.href='http://shrt.in/shrt.php?long='+encodeURIComponent(location)+'&title='+encodeURIComponent(document.title);

You click the bookmarklet while you're on the website that you want to be shortened, then it will redirect you to my website, where you can copy the URL.

I was wondering if I could somehow shorten the URL, and paste it in the address bar without having to redirect to my website.

So you go to the website with a long URL, click the bookmarklet, and the address bar is changed with the new shortened URL.

I know this can be done because I used to use a URL shortener a couple of years ago that had this feature, but unfortunately, the owner gave up on it and it died.

This will be a really great help for me, and I would really appreciate it if you guys could help me out.

if i am getting you right you need to pass parameter with your shorten url for ur original url

below link may help you out for this https://webapps.stackexchange.com/questions/5973/url-shortener-that-supports-parameters

You can edit http://shrt.in/ so that instead of just displaying the shortened link, you redirect right away to the shortened link.

It seems that SHRT.IN is using PHP. Edit the shrt.php file so that you can redirect the user.

You can do it! all you need is an listener on shrt.in which will accept url to shorten and return a shortned url, you need to pass the long url via cross site ajax and get the result from your site, instead of redirecting to your site and then doing the shorting.

hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM