Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code changes to .js file taking no effect using XAMPP

I'm using XAMPP and opening my html file using localhost/filename.html. So both my html document and .js file are in the same directory, in C:/xampp/htdocs. When I open the html file using localhost/filename.html in the browser window, it does not include the changes to the code. It's using the same version of the .js file before I saved the changes. But when I open the html document locally (offline, not running on localhost), the changes to the .js are there.

For example, if I put document.write('foo') in the .js and then hit save, then opening with localhost/filename.html does not print "foo". But if I just open the filename.html through file explorer (on the same browser--chrome), it prints "foo"!

What could be causing this?

OS: Windows

Browser: Chrome

like image 495
Andrew Kor Avatar asked Jun 15 '26 06:06

Andrew Kor


1 Answers

Actually seams that clearing the browser cache solved the problem. i would like to link to a related page:https://superuser.com/questions/36106/force-refreshing-only-javascript-files-in-firefox-and-chrome

I had a similar issue. Here are some things you can try to fix it:
1-Clearing browser cache.(this one fixed mine)
2-Stopping and starting again Apache.
3-(if you use XAMPP control panel)Closing the the control panel and left-click on the icon n the taskbar(near to wifi-sound control or in the compressed up arrow) and clicking on quit
4-Stopping XAMPP; renaming htdocs to something else; editing the "C:/xammp/properties.ini" "apache_htdocs_directory" property to the new path you gave the htdocs.(This can break something so i suggest to repeat this step again after restarting XAMPP and changing back everything to default "htdocs"). 4-Shutting down the OS via cmd.exe with shutdown -s(I personally prefear to use cmd to shutdown because on some PC there's "fast boot" option enable, which means that it hibernates it to boot faster) and then restart the OS.
If I find anything else I'll add it to the list.
(I was still writing my answer while Connum was writing)


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!