Make All External Links Open in a New Automatic Window (Jquery)

Advertisement

Responsive Ads Here

Make All External Links Open in a New Automatic Window (Jquery)

Saturday, October 12, 2019

Make All External Links Open in a New Automatic Window (Jquery) - Hallo Dear, djf-xp.blogspot.com, This article that you read this time with the title Make All External Links Open in a New Automatic Window (Jquery), We have prepared this article well for you to read and retrieve the information in it. hopefully the contents of we write can be understood by you. Alright, happy reading.

Title : Make All External Links Open in a New Automatic Window (Jquery)
link : Make All External Links Open in a New Automatic Window (Jquery)


Make All External Links Open in a New Automatic Window (Jquery)




Automatically open external links in a new window!




We often use the link opening feature in a new window on the Blogger link interface when making a post, or add a link attribute (hyperlink) target = "_ blank". For some manual steps, of course this is not a problem. But if you already have a lot of external links, both in the post section and other parts, such as widgets, footers, etc., of course editing work becomes a time-consuming thing. In addition, external links that open in the same window will increase the bounce rate, thereby reducing a lot of ratings, especially Alexa ranking.






This script is quite simple, in the form of jquery, which is used to check external links in a web page and then inject target = "_ blank" on every external link found on that page. So actually this script does not only work on Blogger, but can be on various website / blog platforms, such as WordPress (although you will find similar plugins easily).




How to Add Automatic External Link Opening Script







Just follow these simple steps:







1. As always, if you already have jquery source code, ignore the script in the first part and immediately copy the second script. If not, copy both and place them in sequence. If you're not sure if you already have jquery source code, look in the template for keywords jquery and see if you already have the same source code.







(ignore the script above if you already have something similar)





2. Open the Blogger dashboard> Template> Edit HTML

3 Look for it (how to search for code in the Blogger template editor)


4. Put the script that has been copied right above .


5. Save the template and done!







You can check external links on blogs that don't have the attribute target = "_ blank", or try to create a new external link without the target attribute. Check whether the script works.


Quick Note: How Script Works & Additional Info








If you pay attention to the script, there is a double check command, namely on links beginning with http: // and https: // (secure connection protocol), meaning that the script also works on hosts and similar external links that use secured connection protocol, for example WordPress and various self-hosted website platforms.

Conditional tag (if) is used to submit requirements / check both protocols, and if the value is the same -1, then the link that must be searched (required) is a link that is not on the same host (not the link to your website / blog), alias is external (External Links).

After the links according to the requirements are found, then the attribute is inserted / injected target = "_ blank" ($ (this) .attr ("target", "_ blank")).

Logically, because of value -1 means the link that is not on the same host (a link that does not go to your website / blog), then the value 1 means the opposite (positive value), i.e. if it is changed from -1 to 1, then all your internal links will open in a new window.

If you want all links, both internal and external, to open in a new window (though I don't recommend it), there's no need to use such a script, just use the tag base targettting the following and place it in the head tag (before ):






Check out more about how to make a link open in a new window / tab.

That's it, and have a nice blogging, fellow brothers and sisters;)

© copyright Ahmad Khoirul Azmi, published only for Buka-rahasia.blogspot.com.




http://buka-rahasia.blogspot.com/http://buka-rahasia.blogspot.com/






Thus the article Make All External Links Open in a New Automatic Window (Jquery)

So this article, Make All External Links Open in a New Automatic Window (Jquery) hopefully can benefit you all. ok, see you in another article post.

You are now reading the article Make All External Links Open in a New Automatic Window (Jquery) with the link address https://djf-xp.blogspot.com/2019/10/make-all-external-links-open-in-new.html