Birthday

July 14, 2012 is TipRicks's Birthday, Please Prepare and Send Good Wishes to its team!

UnderStood
TipRicks is under maintenance! If you found any error please let us know. Contact Us ×

Hello!

Click one of our representatives below to chat on WhatsApp

Support Customer Service Center
+923084774257
You can also send us an email to support@tipricks.com
Hello! What can I do for you?
×
How can I help you?

How to Make Your Own URL Shortener with JavaScript in Blogger

SHARE:

Are you looking to create your own custom domain branded URL Shortener? learn how to make your own URL shortener with JavaScript in Blogger.



Tipricks, How to Make Your Own URL Shortener with JavaScript in Blogger - As you know there are a lot of URL shorteners that are used you shorten URLs. But they don't allow you to shorten your URL with your branded custom domain. We have found a javascript code to make your own short URL with your custom domain to redirect to different external pages as per your need. Today in this article you will see How to Make Your Own URL Shortener with JavaScript in Blogger?.

How does URL Shortener work?

We use a javascript code to create your own shortened URLs. It can also be termed as simple redirect settings. Like in WordPress you redirect your link to an external domain or page. But blogger custom redirects does not allow you to redirect your link to external link. It only allows you to redirect internally.

Shortened URL: tipricks.com/go/facebook

Check the above links to see how this script work.If you go to the shortened URL it will take you to our Facebook page.

Limitations:

There is no limitation of this javascript code you can redirect unlimited URLs to any external page or domain with you own branded custom domain.

Benefits:

If you have not set the username for your social accounts than it is very difficult to remember it. For example, you can see our YouTube channel URL.
[https://www.youtube.com/channel/UCjybl3vsBMHJrebHA9ZQG8A]
I can not write it anywhere so I create a short URL for my youtube channel that looks like this:
[http://tipricks.com/go/youtube]
Share your Shorted URL everywhere, So that later if you change the URL of your youtube channel you just need to change the URL at one place and everyone starts redirecting to the new URL. Instead, you change the default URL everywhere you have to paste it before.

How to Make Your Own URL Shortener with JavaScript?

To install this script in you blogger blog properly, follow the below steps correctly.
  1. First, go to Blogger >>Template >> Edit HTML.
  2. Now in the template code, search for the <head> tag and paste the below code just below it.
[<script language='javascript'>
//Tipricks URL Shorener
//<![CDATA[
var key = window.location.href.split("go/")[1].replace("/","")
var urls={
    'facebook':'https://www.facebook.com/TipRicks.Official/',
    'gplus':"https://plus.google.com/+Tipricks",
    'twitter':"https://twitter.com/MrTahirHabib",
    'youtube':"https://www.youtube.com/channel/UCjybl3vsBMHJrebHA9ZQG8A",
}
if(key){
    if(urls[key]){
        window.location.href=urls[key]
    }else{
        document.write("'"+key+"' not found :(");
    }
}
//]]>
</script>]

  • [message]
    • ##warning##  Alert
      • To prevent an error. Please paste the above Javascript code below <head> tag, Instead of pasting it above </head> tag. You can read the reason at the last of this post. Thanks!

Customization:

Simply change the links with your links and you are done. You can replace go/ with your any other word and Facebook with fb or the word you want. For example, as in the above code, you can make changes like this.
['facebook':'https://www.facebook.com/TipRicks.Official/']
You can change Facebook with fb to make it shorter. And change the URL with your Facebook page URL. The above code means like this:
[http://tipricks.com/go/facebook]
You can add more URLs in the code for example if you want to create the short URL for the Pinterest profile. Your code will look like this.
 [<script language='javascript'>
//Tipricks URL Shorener
//<![CDATA[
var key = window.location.href.split("go/")[1].replace("/","")
var urls={
    'facebook':'https://www.facebook.com/TipRicks.Official/',
    'gplus':"https://plus.google.com/+Tipricks",
    'twitter':"https://twitter.com/MrTahirHabib",
    'youtube':"https://www.youtube.com/channel/UCjybl3vsBMHJrebHA9ZQG8A",
    'pinterest':"https://www.pinterest.com/tipricks",
}
if(key){
    if(urls[key]){
        window.location.href=urls[key]
    }else{
        document.write("'"+key+"' not found :(");
    }
}
//]]>
</script>]
And your short code for Pinterest profile become this:
[http://tipricks.com/go/pinterest]
3. After customizing the code Click the Save template\button at the top.

Hope you like the tutorial. Please give us feedback below in comments.If you find any error or mistake please let me know below in comments.

This article "How to Make Your Own URL Shortener with JavaScript in Blogger" is protected by




Was this article helpful?

Thanks! Your feedback will help us to improve our Services.

COMMENTS

BLOGGER: 10
  1. Hi my loved one! I want to say that this post is
    amazing, great written and come with almost all important infos.
    I'd like to look extra posts like this .

    ReplyDelete
  2. I was recommended this web site by my cousin. I'm not sure
    whether this post is written by him aas no one else know such detailed about my trouble.
    You are wonderful! Thanks!

    ReplyDelete
  3. I uѕed to bе abⅼe to find good advice frоm үoᥙr
    blog articles.

    ReplyDelete
  4. I truly love your blog.. Great colors & theme.
    Did you develop this website yourself? Please reply back as
    I'm planning to create my own personal website and would like to find out where
    you got this from or exactly what the theme is called.
    Many thanks!

    ReplyDelete
  5. can you help me for https://www.bloggerfunda.info

    ReplyDelete
  6. This article is very helpful. thanks sir I’m so glad I found my solution online. short url creator

    ReplyDelete
  7. i like your post and the picture """" Free Kashmir From india """""""""""

    ReplyDelete
    Replies
    1. Thanks for the appreciation! "Kashmir will free, InShaAllah"

      Delete

Need help? Contact to our support center at +92 308 477 4257
Name

Agriculture PPT Templates,2,AI Tools,1,Amazon,1,AskTipRicks,9,Blogger,48,Blogger-SEO,6,Blogger-Templates,1,Blogger-Tutorials,32,Blogger-Widgets,11,Blogging-Tips,7,Books,1,Business,1,Computer PPT Templates,1,Computer-Tutorials,1,Creative-PowerPoint-Templates,2,Digital Marketing,1,Domain,1,Ecommerce,1,Facebook,4,Free-Mobile-Data,1,Freenom,1,General,7,Google-Adsense,4,Google-Analytics,2,Google-Classroom,3,Instagram,2,Internet,1,Interviews,1,Islamic PPT Templates,1,jQuery,1,Marketing,1,Medical PPT Templates,1,Microsoft-Word,3,Mobile-Marketing,1,Motivation,1,MS Word,1,News,25,News-Updates,26,Oppo-Mobile-Features,1,PDF,1,PowerPoint-Templates,7,Resume-Templates,2,Reviews,3,SEO,8,Social-Media,6,Tech-News,15,TrueCaller,1,Twitter,1,Videos,24,Vlogging,1,Web-Hosting,1,Whatsapp,3,WordPress,8,WordPress-SEO,1,WordPress-Themes,1,WordPress-Tutorials,4,Youtube,5,
ltr
item
TipRicks Blog: How to Make Your Own URL Shortener with JavaScript in Blogger
How to Make Your Own URL Shortener with JavaScript in Blogger
Are you looking to create your own custom domain branded URL Shortener? learn how to make your own URL shortener with JavaScript in Blogger.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1EH3GlGv5znFynDiSLTScW82okradRKt6B42ne5hJSpBwaW91KGTyqqXTe4W26uAZTbshv_Hb6gzqwVd12aDwSbSURfhmbA_kKANLZG9Vs8zSWLlWwQU5GLODHlE3udDMf9zmGWlUeBF3/s320/Untitled+1.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1EH3GlGv5znFynDiSLTScW82okradRKt6B42ne5hJSpBwaW91KGTyqqXTe4W26uAZTbshv_Hb6gzqwVd12aDwSbSURfhmbA_kKANLZG9Vs8zSWLlWwQU5GLODHlE3udDMf9zmGWlUeBF3/s72-c/Untitled+1.png
TipRicks Blog
https://blog.tipricks.com/2016/08/how-to-make-your-own-url-shortener-with-javascript-in-blogger.html
https://blog.tipricks.com/
https://blog.tipricks.com/
https://blog.tipricks.com/2016/08/how-to-make-your-own-url-shortener-with-javascript-in-blogger.html
true
7070217950916442682
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy