Tempalte File won't update in Browser - javascript

im trying to change some behavior of a webpage. The page is built using SMARTY so the file that won't update is a .tpl file. Containing mostly JavaScript. The whole thing is weird because on my local drive (IDE) the file is the way i want it to be, it is the correct version on the server when i check it with SFTP.
BUT if i open the page with a browser, even a newly installed one, the code inside that page is the old version.
Now i can't send any error because there obviously is none.
So im lookin at a problem i can't fix or even begin to untangle.
I tried following things:
Restarting apache2
Deleting the file and uploading the correct version (here i might add the site broke when i deleted it and tried to view it)
This has been bugging me for a long time so it seems time couldn't fix it either.
I hope somebody has any idea to why this is happening!
Thanks

Clear (delete all cache files) smarty cache!
More details about cache dir: https://www.smarty.net/docs/en/api.set.compile.dir.tpl

Related

Why my changes are not displaying to the browser?

(this a long text but it's necessary for you to understand what I'm struggling with)
I've been trying to find a solution to this but I just couldn't find any info related to this so I wonder if it has to do something with my computer.
The problem is that when I am coding working on website in neither Sublime Text or VSC, (in the beginning everything was okay, I used to refresh the page or use a local server and my changes display on the Web page) any changes I make in the .html, .css or .js files don't show on the browser.
I tried closing and re-opening the text editor and the files, (that used to work at first) but now that doesn't work anymore, any simple change made after this "forzing" happens, just doesn't display on the browser. I tried also using opera, mozilla, chrome, and the problems persist.
I sent the files once to a friend of mine, he opened the .html file and my changes were working. He resend me the code after he used it, I pasted it (the same I sent him before that wasn't working) and then magically it worked!!!!
Now every time that happens I have to have Another personas computer to open the .html file, they resend it to me, I paste it again in order to make it work. This is so annoying and frustrating. If any of you could help me with anything to fix this, I'd very much appreciate it.
So in short, until some point my changes are displayed, but after that, the page stays the same as when it "freezes" and no matter which file I modify, the page just doesn't show changes after that freezing point
Thanks for your atttention
Since it doesn't work on a local computer, you can always use an online editor like Replit or CodePen (they worked quite well for me) ...
It could be that the files aren't correctly saved into your working directory. If you go into your terminal and navigate to the directory these files you're working on are in and type ls it will show all the files in this directory. If your files aren't there then you know you didn't save the files correctly into your working directory.

How to fix javascript file referencing old version

My problem is when I edit my previous javascript or css file link to my html file, the function/code that I add are not functioning even I delete the whole code in my js file. The previous code only is functioning.
It might be your cache were not deleted ,that's why it still using your previous javascript file.
To fix that:
Empty your cache
(In GoogleChrome ) Open developer tools( or press F12 ) then You can right click on
refresh and select Empty Cache and Hard Reload
Your updated javascript now will be loaded.
CLEAR GOOGLE CHROME CACHE
CLEAR FIREFOX CACHE
CLEAR INTERNET EXPLORER CACHE
What server software are you hosting with? Apache? Express/node?
I noticed depending on how I configured something like forever or nodemon to host my express sites, it did not reflect changes when not using grunt. I had to restart them to get them to use the newly changed files.
Did you use a Yeoman generator?

Js extension modification not showing up in magento

So I have installed an extension in magento for a popup. The extension worked fine but i wanted to change the size of the popup wich is calculated in a js (fancybox). When I finally made it to make the changes that I wanted I noticed that Magento is not serving me the new modified javascript file.
This is what I tried so far by googling all around:
Refreshing the cache
Flush the js/CSS cache
Flush the store cache
changing permissions on the file to 666 then back to 644
changing the js merge on or off
Checking the cache in the database (all clear)
Checking if unsecure route and secure route are spelled fine (in the database and in magento admin panel, not very sure how this work though)
I am going mad.
One more thing:
If I access the js file from secure path
https://mysite/jspath/jsfile.js (it shows the old file)
And if:
http://mysite/jspath/jsfile (it shows the new file)
http://mysite//jspath/jsfile (it shows the new file)
Since I am not the only admin in the site I don't know if someone else made change to some magento configuration
Any idea is welcome and appreciated, thanks
If compilation is on, re run the compilation process.
Due to the fact that it is serving up the old file still, it seems like there is still come caching there. You say you flushed the js/css cache. Can you flush all caches and see if its still a problem?

Updated website through FTP but still showing old content

I am working at a project on my webhost. Until today everything went fine, but now I save the files, they update on the ftp but when I refresh the my webpage the old content shows up, not the updated one.
I checked the FTP, the files are updated with the new content and saved. I checked with the Chrome Dev Tools and I keep getting the old content from the files I work on.
I tried deleting the cache a few times but it only worked temporarily(once), and then again the content not updating.
I work with php, css and javascript files, all having the same problem.
What is wrong?
This is because Cloudflare automatically saves some files (i.e. Javascript's, CSS...). When you're in that kind of problems, in Cloudflare you should go to your page's settings and then "Cache Purge", you purge the cache and then it should work nice.
SOLUTION:
It was because of a CDN I was using, called CloudFlare. I have no idea why, but it kept the old content instead of updating the new one.
Be careful when using CDN's.

Javascript not working on localhost, but it is working on Live site

I am facing JavaScript problems on XAMPP Localhost. The Collapse Buttons, go to top button and jQuery news feed are not working on every site on my localhost.
But Facebook, Twitter, Plusone buttons load correctly from remote server i.e. from the respective Social Sites.
So, I think it narrows me to the point that the JavaScript files hosted locally are not executed while those from Facebook etc. are getting executed.
I tried reinstalling XAMPP but didn't work.
I know this is old but, I had the same problem and found this question while searching a solution. But I have lampp installed on ubuntu and since Linux asks permission to execute ANYTHING, the local js files which resided in htdocs were without permission. After:
sudo chmod 777 -R /opt/lampp/htdocs
... everything was OK. Hope this helps future wanabee web developers.
It should not matter whether your files are local or not...javascript should still get executed. Try using some debugging tool like to see if you get any errors that only occur on your local machine. Because it could be that you are running some code that is depending on a domain or whatever.
I know this post is old and the answer is already given, I just wanted to give an answer of a possible reason that I encountered in case someone else finds this and it does not help.
Make sure your entire html code gets executed by viewing your page source. With me, half my code was not being executed due to a PHP error that was working on localhost with the local database but not on live with the live database. This caused the HTML to cut of from that point above my javascript.
So check your page source. If it is being cut of somewhere, find out why :)
I had the same problem. I try a lot but finally solved. The main problem was my browser cache that prevents from loading the new JavaScript file. My recommendation is that clear your browser cache data then close the browser and reopen your site again it will work perfectly.
remove any (pre in post ) blank spaces from filenames of your namespace example : localhost:port/dir /index.html
localhost:port/dir/index.html
In similar cases,
If web project site runs JS on Live Server but not on locally opened index.html,
try to check validity of HTML File Paths,
e.g you may have written:
<script src="script.js"></script>
instead of:
<script src="./script.js"></script>
Try to add ./ before file name.
./ means Current directory.

Categories

Resources