I'd like to declare a global variable in an external javascript file and have it become accessible in the main window that loads the file.
So far the following methods have failed
var foo = 'bar';
window.foo = 'bar';
Only implicit globals seem to work
foo = 'bar';
However, people seem to recommend against ever using implicit globals. So what should I do in this case?