Skip to main content

Posts

Showing posts from September, 2020

Blogger Tweak - Open external links in new tab automatically

So, once upon a time, a really long while ago, I tried to customise and recreate a Blogger template which is not available anymore, but there's one thing I remember about it. I had a jQuery code written to make all the external links open in new tab. I also thought, it's about time I revive that idea and write a more intact code and here we go. So, there are two things to do. 
Add Javascript code that detects external links and opens them in new tab.Add a CSS code to let users know that a particular link is going to be opened in new tab.Adding a javascript codePlease follow the instructions below, Go to https://blogger.com dashboardNavigate to Themes > click the down arrow near "Customize" and then click on Edit HTML.


Now scroll to the very end and paste the following code just before </body> tag.
<script type='text/javascript'> document.body.addEventListener(&quot;mousedown&quot;,function(event){ if(event.target.tagName === &quot;A&q…