conditionally load javascript resource
问题 I'm creating a website which some of it's pages contain at least one media player and because of the page size limitations, I want to load the media player javascript file only in pages that have medias. I store media information in an javascript object in head of the page and other script files are being loaded at the end of body. I found this solution (using $.getScript ) very nice but I want a solution that doesn't rely on any frameworks. I saw an interesting implementation in jQuery