search
Carter Cole LinkedInCarters Twitter PageCarter Cole on Facebook Carter Coles RSS

Tuesday, July 20, 2010

Enforce your link attribution requirements on your widget or API with JavaScript

A while ago doing a Mozinar I mentioned I had written a little snippet of JavaScript I used to enforce link attribution requirements on widgets or API I release (and for my clients). Heres what I came up with and optimized... it currently just checks for meta robots tag and a clean link but I may add a robots.txt check after I convert the rule parser into javascript

but this is what I came up with and how you can use it on your scripts and APIs. the first part where new RegExp("http://cartercole.com","i") thats the regular expression that checks the links on the page, then you got window.open("http://cartercole.com"); thats the line thats true when the page isnt passing rank... that means its meta robots is nofollow or it dint find a link matching requirements without a nofollow directive

Code:

I put this code on the end of my JSONP API responses. It requires 3ed parties consuming your API to have a clean link pointing back to you, which is really cool because links are like the money of the internet

if you want to hide your javascript tests a little better you can try using this popular packer but like all popular scripts it has been reversed and beautified shh :) its nice for formating JavaScript your reverse engineering too

if you have any questions: im @cartercole; follow me now.

0 remarks:

Post a Comment

Link to this post if you found it usefull

Enforce your link attribution requirements on your widget or API with JavaScript