Rough implementation with PhantomJS