Pass in an url and get back the html cleansed of js..
JavaScript CSS
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
.gitignore
LICENSE.txt
README.md
npm-debug.log
package.js
package.json
phantomjs-script.js
url_washer.org
wash.js

README.md

url_washer

var wash =require('path/to/wash.js');
var washed = wash('someurl', someOptions);

wash returns a vow (Crockford's version) that promises to deliver html rendered by phantomjs after browsing someUrl.

If phantomjs is not on the path, you can pass in the path in options:

someOptions = 
{ phantomPath: 'path/to/phantomjs', 
  seoServer: 'seoServerUrl'}

You can also do

npm install phantomjs 

in the url_washer dir.

Or uncomment the phantomjs dependency in package.js, then:

node package.js
npm install

If wash can't find a phantomjs executable it will ask the seoServer (if set in options)

It will do an ajax call to http://seoServerUrl?url=someUrl, and expect html to be returned.

Finally:

washed.when(function(html) { 
   //send the html perhaps
},
function(err) {
  //no dice, you will have to send uncleansed html
})