Breaking News

How To Open Menu Item In New Tab When Click

How To Open Menu Item In New Tab When Click


Normally we click in the menu of our web it opens in the same page so it disturbs our home page and makes the customer to go back and resign our page. If it is open in new page then still our main web is open and visitor again can come back and view our web
Let's do below 2 Methods to do it in a simple way
1.       Just go to your theme and click on edit HTML and paste below-given code above the </head> tab, to find </head> tag just find it from Ctrl+F in your theme HTML view

<script type='text/javascript'>
 $(document).ready(function() {
 $(&quot;a[href^=&#39;http://&#39;]&quot;).each(
 function(){
 if(this.href.indexOf(location.hostname) == -1) {
 $(this).attr(&#39;target&#39;, &#39;_blank&#39;);
 }
 }
 );
 $(&quot;a[href^=&#39;https://&#39;]&quot;).each(
 function(){
 if(this.href.indexOf(location.hostname) == -1) {
 $(this).attr(&#39;target&#39;, &#39;_blank&#39;);
 }
 }
 );
 });
 </script>
2.       Just Paste Blow to code just above the </body>
<script>
//<![CDATA[
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
//]]>

</script>

1 comment: