I am using the Prototype javascript framework. I have included it in a javascript code snippet that I allow people to copy and paste onto their websites. There is a possibility that their website already includes Prototype or they wanted to include the snippet multiple times. In both cases, Prototype will be defined twice and, as a result, IE7 will not function. It will say "Object does not support this property or method" on nearly any Prototype library function call. I tried this:
if (typeof(Prototype) === 'undefined') {
alert('including Prototype');
// minified Prototype code here
}
alert('running my code');
// all my code here
When I ran this, only "including Prototype" was alerted, but "running my code" never got alerted. Why?