I'm building a service that allows people to put a javascript code I gave them to their site. The javascript code is based on jQuery.
My question is how to do this to be safe and optimized, cause I don't want to break certain users website.
The thing I'm looking for so far( you can update if you think I need to face other problems):
- what happens when the user already has jquery loaded on their page? should I load my jquery library using different namespace or should I use his jquery library.
- in case I can use his jquery library, I think I'll need to check to see if the versions corespond, but again is this safe?
- in case I want to use his jquery library, how do I check if he has jquery loaded and if he has the right version
- this is related to 3. what happen if he changes his jquery library that doesn't correspond with the library I think it will be, leading to a bad result.
Looking for your answers. Thanks