0

I am having some weird issues getting with javascript running on a friend's machine. I have a form wizard that perform certain checks and operations. I use external jquery and bootstrap libraries with a custom script also. The script works on all browsers I've test so far including old IE , however a friend reports the following errors when accessing the form url.

chrome console error message

The strange thing to me is every error is on line 1 and haven't touched any of the libraries. External Library linking

<script src="assets/js/jquery-1.11.1.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/js/jquery.backstretch.min.js"></script>
<script src="assets/js/retina-1.1.0.min.js"></script>
<script src="assets/js/scripts.js"></script>

custom script.js overview

jQuery(document).ready(function() {
...
// javascript code
...

});

Anything I should try or do?

Penny Codes
  • 182
  • 2
  • 10
  • That error is usually assoicated with an ajax call or the like that is expecting json as a response, but is instead getting an html document back – Taplar Jun 01 '20 at 21:44
  • 2
    Look at the files, Looks like something is injecting HTML.... – epascarello Jun 01 '20 at 21:45
  • Mmm, I wonder if one of the js files starts with ` – Taplar Jun 01 '20 at 21:45
  • Check the network tab of your dev tools. Does it show any error/unexpected result when fetching the resources? – Benjamin Eckardt Jun 01 '20 at 21:46
  • @BenjaminEckardt , everything gets fetch successfully, just this console error message – Penny Codes Jun 01 '20 at 21:48
  • @epascarello , What possibly could be.. Kinda lost on injection – Penny Codes Jun 01 '20 at 21:49
  • @Taplar I suspect each of those files starts with `` and then contain a page that shows an error like 403 or 401. Maybe a 404. It's the most usual case here - returning an error page instead of JS. – VLAZ Jun 01 '20 at 21:49
  • @Taplar , I'm not actually using much of this libraries just to control the form wizard and style the page. – Penny Codes Jun 01 '20 at 21:50
  • 2
    LOOK at the network response.... what is in the file. – epascarello Jun 01 '20 at 21:51
  • @WanPeninsula Your question states that you're trying to get it to run on a friends machine, and that you are using external libraries. However, your urls are not external urls. They are relative path urls. Can you elaborate on what you mean by getting it to run on your friends machine? – Taplar Jun 01 '20 at 21:51
  • @Taplar , sorry about misinterpretation, I downloaded the libraries and and linked them in the ```index``` file. The actual probelm here is, at my end, everything gets executed without errors and have tested in multiple browsers, but on the end of the friend testing, he gets thrown with this error in the console – Penny Codes Jun 01 '20 at 21:56
  • So how is your friend testing it? If you downloaded the files, then they are on your machine. How is your friend testing it on their machine? – Taplar Jun 01 '20 at 21:58
  • @Taplar, I sent a ```zipped``` archive over. He just unpacked and access it local on his browser – Penny Codes Jun 01 '20 at 22:01
  • K, just double checking that you also sent him the files you downloaded. – Taplar Jun 01 '20 at 22:02
  • have already. repacked and sent over more than ```5 times``` . same files in his directory – Penny Codes Jun 01 '20 at 22:04
  • Check that your friend is referring the script files from the correct path (where he has copied the script files and mentioning that address in code). Also check [This link](https://stackoverflow.com/a/31529506/6545996) – Ashu_90 Jun 01 '20 at 22:54

0 Answers0