How to open links in a new tab

This article will present how to open links in a new tab using the Orbit Fox plugin, so make sure you have installed and activated it before reading the steps below.

1

Go to Dashboard > Orbit Fox General settings and make sure you have activated the Header Footer Scripts option.

2

Navigate to Appearance >  Customize > Header/Footer scripts, and paste the JS code snippets.

To open any particular link on your website in a new tab, use this code snippet:

<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(".item--inner.builder-item--button_base .component-wrap .button.button-primary").attr('target', '_blank');});
</script>

📝 Note: Make sure you replace the class inside " " with the particular class of which link you want to open in a new tab.

To open all the links on your website in a new tab, use this code snippet:

<script type="text/javascript">//<![CDATA
jQuery(document).ready(function($) {
$('a').each(function() {
var a = new RegExp('/' + window.location.host + '/');
if (!a.test(this.href)) {
$(this).click(function(event) {
event.preventDefault();
event.stopPropagation();
window.open(this.href, '_blank');
});}});});//]]>
</script>
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us