1 page = require('webpage').create()
2 system = require 'system'
4 page.onInitialized = ->
6 userAgent = window.navigator.userAgent
7 platform = window.navigator.platform
14 window.navigator.__defineGetter__ 'userAgent', ->
15 window.navigator.sniffed = true
18 window.navigator.__defineGetter__ 'platform', ->
19 window.navigator.sniffed = true
22 if system.args.length is 1
23 console.log 'Usage: detectsniff.coffee <some URL>'
26 address = system.args[1]
27 console.log 'Checking ' + address + '...'
28 page.open address, (status) ->
29 if status isnt 'success'
30 console.log 'FAIL to load the address'
34 sniffed = page.evaluate(->
38 console.log 'The page tried to sniff the user agent.'
40 console.log 'The page did not try to sniff the user agent.'