ads1

Blogging tips: Open all external links in a new page

Blogging tips: Open all external links in a new page - Hallo Friend 18+, on this occasion, entitled Blogging tips: Open all external links in a new page, I provide a variety of videos from around the world.

Artist : Blogging tips: Open all external links in a new page
Episode : Blogging tips: Open all external links in a new page

lihat juga


Blogging tips: Open all external links in a new page

Artikel Blogging, Artikel HTML, Artikel javascript,

lihat juga


Blogging tips: Open all external links in a new page

I posted some days ago about opening all links in your website in a new tab or window by default (old post here). The problem of that solution is that all internal links are opened in a new tab, even the "home" button. This is so disgusting for the users of your website.

Here there is a solution to open all external links in a new tab or window (if the target is a tab or a window depends on the browser). Include this lines into your website and the job is done:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
//<![CDATA[
jQuery('a').each(function() {
    // Let's make external links open in a new window.
    var href = jQuery(this).attr('href');
    
    if (typeof href != 'undefined' && href != "" && (href.indexOf('http://') != -1 || href.indexOf('https://') != -1) && href.indexOf(window.location.hostname) == -1) {
        jQuery(this).attr("target", "_blank");
    }
});
//]]>
</script>

If you are using blogger, you can include this by inserting it before the </body> tag (Dashboard -> Template -> Edit HTML, search the </body> with Ctrl+F and insert it before the tag closes. Remember to save always a backup of the HTML before change it) or inserting in a HTML/Javascript widget element.

With this feature, all links other than adSense and your domain, will open in a new tab (if you're using blogger, all links to other blogger sites won't be affected and will open with the default properties).


Source: Challenges that each developer faces every day


Thus articles Blogging tips: Open all external links in a new page

A new berita Blogging tips: Open all external links in a new page, hopefully we can add to the excitement of your life.

You're reading an article Blogging tips: Open all external links in a new page and this article is a url permalink I hope this article can be useful .

Tag : , , ,

0 Response to "Blogging tips: Open all external links in a new page"

Post a Comment