jQuery Plugin To Detect Broken External Anchor Links link checker js - Download jQuery Plugin To Detect Broken/External/Anchor Links - link-checker.js

Download jQuery Plugin To Detect Broken/External/Anchor Links – link-checker.js

Posted on

This time I will share jQuery Plugin and tutorial about jQuery Plugin To Detect Broken/External/Anchor Links – link-checker.js, hope it will help you in programming stack.

jQuery Plugin To Detect Broken External Anchor Links link checker js - Download jQuery Plugin To Detect Broken/External/Anchor Links - link-checker.js
File Size: 4.86 KB
Views Total: 1653
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

link-checker.js is a simple yet really useful jQuery plugin that automatically detects broken / internal / external / anchor links within the document and then adds corresponding CSS classes and rel & target attributes to them based on the URLs.

How to use it:

1. To get started, include the jQuery link-checker.js script after you’ve loaded jQuery library as this:

1 <script src="//code.jquery.com/jquery.min.js"></script>
2 <script src="link-checker.js"></script>

2. Initialize the plugin and we’re ready to go.

1 $('a').linkChecker();

3. Style the links based on their current status:

1 .internal-link { ... }
2  
3 .external-link { ... }
4  
5 .anchor-link { ... }
6  
7 .broken-link { ... }

4. By default, the plugin will automatically adds the rel='nofollow' and target=’_blank’ attributes to your external links. You can disable them in the JavaScript as this:

1 $('a').linkChecker({
2   externalLinkNoFollow : true,
3   externalLinkBlank : true
4 });

5. More configuration options.

1 $('a').linkChecker({
2   hostname : new RegExp(location.host),
3   animateAnchorLinks : true // for scroll to
4 });

This awesome jQuery plugin is developed by db-dzine. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net