javascript - Newbie Jquery questions - versions and linking to source -
I have 2 questions about these jquery contexts with which I am working on a website. I do not have so much with php, css, html and isssl, but javascript and jquf
With this being said .....
Suppose I have a jquery file located here: mysite.com/js/jquery-1.3.2 Min.js
Question 1: The jquery file should have it src
reference on 3 different methods in different ways. Is one of those methods better / faster / more efficient than others?
1. Src = "http: //www.mysite/js/jquery-1.3.2 .min.js" 2. Src = "js / jquery-1.3.2.min.js" 3. Src = "/home/hostingaccountname/public_html/js/jquery-1.3.2.min.js"
Question 2: Some pages /js/jquery-1.3.2 Refer to min.js
and others (later to be made) / js / jquery- 1.8.3.min.js
. Is it safe to believe that 1.8.3 is upgraded to 1.3.2 and that I can replace all the 1.3.2 references with 1.8.3? Does this work like this or am I making a bad / dangerous assumption?
Sorry, I know that these are probably dumb questions, but I want to be protected globally before changing many different references of jquery Thanks in advance.
Answer 1: You must provide relative path to your jquery file location . Suppose you have several websites that use the same code structure. If you give jquery space like 1, then your jquery will not be found on some of your domains. There is no need to say anything about 3 because you are giving information about your system path to the user. Do not use option 3. Besides, I suggest you to load jquery from the CDN,
Answer 2: If you update the jquery version, some of your code may give an error or warning, test your upgrade at your local local and successful Upgrade your jquery version after operation. If you have errors, fix them and upgrade to jquery Also, if you have unit tests for JS, this will help you to upgrade your jquery. Upgrade Jquery and run your tests, and see where there are errors
Comments
Post a Comment