loadurlwithoutcss.coffee 586 B

1234567891011121314151617181920
  1. page = require("webpage").create()
  2. system = require("system")
  3. if system.args.length < 2
  4. console.log "Usage: loadurlwithoutcss.js URL"
  5. phantom.exit()
  6. address = system.args[1]
  7. page.onResourceRequested = (requestData, request) ->
  8. if (/http:\/\/.+?\.css/g).test(requestData["url"]) or requestData["Content-Type"] is "text/css"
  9. console.log "The url of the request is matching. Aborting: " + requestData["url"]
  10. request.abort()
  11. page.open address, (status) ->
  12. if status is "success"
  13. phantom.exit()
  14. else
  15. console.log "Unable to load the address!"
  16. phantom.exit()