- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Load local scripts. Why does this feel so ugly to me??
Howdy folks,
Been away from the computer for LONG while now. Starting to get back in the grove and im helping a buddy out with one of his projects. Heres the deal:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write(unescape("%3Cscript src='js/jquery-1.9.1.min.js'%3E%3C/script%3E"))</script>
Well, i wanted to do the same thing for a the validation plugin but my result just feels so UGLY and I cant shake why. It works and isnt killing performance, i just feel that im doing it wrong.
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/jquery.validate.min.js"></script>
<script>window.jQuery.fn.validate || document.write(unescape("%3Cscript src='js/jquery.validate-1.11.0.min.js'%3E%3C/script%3E"));</script>
I will totally check out yalls feedback.
I would only check if jQuery is cached by browser. The validate fn probably wouldn’t be, so I would just load it locally and not worry to much about it.
@AlenAbdula : Yeah, you’re right. I’m pretty sure i’m over thinking things again lol. Thanks for the swift slap in face of truth…