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.
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.
3. Style the links based on their current status:
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:
2 |
externalLinkNoFollow : true , |
3 |
externalLinkBlank : true |
5. More configuration options.
2 |
hostname : new RegExp(location.host), |
3 |
animateAnchorLinks : true |
This awesome jQuery plugin is developed by db-dzine. For more Advanced Usages, please check the demo page or visit the official website.