I am working with a dynamic web project, where some of my JSP files need to use Jquery scripts.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
As seen in the above tags, i use absolute URLs that points to scripts from web(googleapis site). I use the jquery scripts mainly to achieve autocomplete feature for one of the fields. The relevant js file for autocomplete is as follows
<script type="text/javascript" src="resources/script/jquery.autocomplete.js"></script>
As seen in the above tag, the script src is relative URL, where i have already downloaded the script from the web(https://pengoworks.com/workshop/jquery/lib/jquery.autocomplete.js)
My questions are,
Will the absolute URLs in the scripts tag (referring jquery.min.js and jquery-ui.min.js) work perfectly and serves it purpose when my web application is deployed as .war file into the production server remote, where there is no internet ?
I also tried downloading the jquery.min.js and jquery-ui.min.js into my relative folder paths resources/script, and gave the script tag as
<script type="text/javascript" src="resources/script/jquery.min.js"></script>
But this is throwing the error in chrome's developer console as below
> jquery.autocomplete.js:257 Uncaught TypeError: Cannot read property 'msie' of undefined
at receiveData (jquery.autocomplete.js:257)
at Object.success (jquery.autocomplete.js:329)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at y (jquery.min.js:4)
at XMLHttpRequest.c (jquery.min.js:4)
Suggestions for best practices in these cases, is also welcome.
If you include ALL the jQuery files in the war, your relative URLs should work offline
Your jQuery is ANCIENT
The pengoworks autocomplete is using $.browser.msie which has been removed from jQuery - but it should still be there in 1.3
This property was removed in jQuery 1.9 and is available only through the jQuery.migrate plugin. Please try to use feature detection instead.
You can add it back using a $.browser polyfill or remove it by using another autocomplete
Since you use jquery.ui, you have one available: https://jqueryui.com/autocomplete/
I recommend