Only run if window actually exists :/
Merge pull request #4 from AmpersandJS/fix-issue-2

Only run if window actually exists :/