deleted file off server, file still accessible - javascript

Ive done this a million times but this time its having its way with me. I usually work on joomla sites and this one is a drupal site so maybe theres something to that.
In filezillla, i uploaded scripts.js.
I noticed an error in my script. I fix it and reupload it. No failed transfer. I check to make sure the fix works, but find the old version of the code still there.
Ok, I clear chromes cache, reload. Old code still there.
I delete the file off the server. Old code still there. (!!)
I completely barf all over the javascript. Should throw errors. I upload it. Old code still there and no errors.
I change the name of the new scripts.js to scripts2.js and upload it. I navigate to that file via browser URL. Not found. Its right there in the server though, uploaded and refreshed the filezilla pane. Filezilla says its there. Browser says its not. Copied / pasted the path. Theres no spelling mistakes. New file being reported as 404 by browser.
I completely delete project folder off server and reupload. Old code still there. Starting to go nuts.
This has got to be some sort of caching issue.

There is a "clear all caches" function in Drupal. It should be under Settings -> Performance. Try that.

Related

why doesn't my live server work in visual studio code?

My live server on visual studio keeps opening an old html file when i try to open my current one. Ive tried reinstalling the extension but its the same problem. Can anyone help please
i cannot have two project folders with an html file running through the live server. Only one html file can be streamed at one time other wise when trying to stream the second, it will stream the first (Like the issue i was having)
I was having the same problem but later on I find out that, I renamed my project folder while my server was still loading the same project but with the previous folder name so I changed the link to my new folder folder name and it worked for me.
I have live server will simply not work if there was an error in JavaScript file.
Even if you do an alert in the beginning of JavaScript file (for test purposes) but at the end of the file re-define a variable which was already defined before, this error will render liver server not working.
The html page will not respond as well.
Solution is to go to developer tools (F12), see the errors on console, fix them and save and the live server would be back in action! At least that was the case with me.
I had the same issue, sometimes it was an error on the console, or keep showing an old HTML, tried everything, deleting cookies, reinstalling everything and nothing worked,
Eventually, it worked with a hard refresh, what it really worked was to
Go to ---> vs code settings ----> extensions ---> live server config set as chrome private. So far no more errors!
The liveserver extension serves static pages like html files and it does not load javascript or typescript files. You need to setup a server yourself for example in react you use webpack to configure your local server and your app runs on a localhost:port. In a nutshell, you need to write a script for node to run your js files. And you won't need liveserver after that.

UwAmp server doesn't detect changes that've made in files

everyone!
I'm using UwAmp 3.1.0 for my php development but I had some troubles
with it.
It worked perfectly at the beginning and the server still works
perfectly now but whenever I made a change to a .js file or .php
file it doesn't reflect that change when I update the page in the
browser.
I went to the chrome dev tools and opened the source section to see if the file is exactly what I wanted but it shows the original version which I've amended a while ago. The links to all files are correct and they are in a subdirectory in www folder.
It's so frustrating as I can't see the changes in action. I checked
the syntax and everything is ok but it doesn't want to stop an
animation in jquery after I it was fully shown to the user.
Can you help me with this situation as I have no idea what's causing the problem here?
It should update the file instantly when I click refresh in the
browser but it doesn't and keeps loading the version of the files
that I started to work with.
Uwamp is AMP stack (Apache, MySql and PHP) and "out-of-the-box" it doesn't have anything with caching of files.
Apache is normally reading/getting files from Uwmap www folder "as is" so basically if your last change is saved into file in www folder (please check directly with tools like notepad) Apache will read it instantly.
This is related to your Browser Cache (Empty yours Browser/Chrome cache manually or install Chrome extension like [Clear Cache Extension]:https://chrome.google.com/webstore/detail/clear-cache/cppjkneekbjaeellbfkmgnhonkkjfpdn?hl=en) and try to clear cache but completely ("from begining of time" like Chrome said).
Also a workaround is to click that Empty Cache icon every save before refreshing the page beacuse it will clear it almost instantly (depending on how long time ago have you cleared your cache)
Also try to set OPCache in Php.ini (settings file) in Uwmap to Disabled (locate opcache settings in php.ini and put 0 to disable - you can access it from Uwamp GUI also).

GET error on loading .css and .js files from server

I need some help. I am working on the web page based on prestashop.
I've done everything on the local server on my machine.
Everything worked correctly. I decided to public the page so I move to the server.
When I open the page with chrome or other browser It looks very bad.
I checked the console and I've got some errors like this:
boston-armatura.pl/:26
GET http://boston-armatura.pl/new/themes/boston/assets/css/mystyle.css
boston-armatura.pl/:28
GET http://boston-armatura.pl/new/themes/boston//assets/css/theme.css
There is quite a long list.
I tried to change privileges.
I am also sure that the path is correct.
what might be the problem?
The server is not allowing you to access those files maybe due to some configuration you might have made on your .htaccess(webconfig) file.
And that's why it is giving a 403 error.
If there are errors, edit your .htaccess file which this:
Options -Indexes
This will deny access to just the directories and no js, css and any other files.

Javascript broken in localhost (and Chrome) but OK in Firefox. But not broken at all when uploaded

Below is the screenshot of the broken page and the second screenshot is what it's supposed to look like.
The error for the above is below:
GET http://localhost:8888/assets/global/css/components-rounded.min.css 404 (Not Found) jquery.min.js:4
I tried to find this components-rounded.min.ss inside the jquery.min.js, but I did not find any.
So it has error in jquery? But that's the official jQuery, and not something else.
The picture below is what the page is supposed to look at.
Somehow when I uploaded it to my server, it's OK for both Chrome and Firefox. I'm dumbfounded by this. I've tried changing the jQuery, it's still the same.
What can I do to fix this?
EDIT:
Most people ask me to download that components-rounded.min.css
But the file do not exists both in the server or in my local. But somehow it's working when I viewed the page in the server. And that components-rounded css file also does not exists in my server.
Yep, I've cleaned up my browser cache. Twice.
Download that file from your server and place it in the right file locally. Ideally commit it to version control too :)
You need to download the css file components-rounded.min.css and save it locally in your css folder.

How to debug when javascript doesn't load

I have 2 sites using the same theme. (http://www.kentishtowner.co.uk and http://here-is.com/kentishtowner-old/ )
They are WP multisite subsites, both using the exact same child theme (same template files exactly).
However, the former website is not loading javascript, causing the masonry layout and mobile menu to not work!
I assume this is something to do with when I mapped the domains, or changed the URL from something like here-is.com/kentishtowner-new to here-is.com/kentishtowner, before domain mapping...
As I am not a JS person, can someone give me some insight as to how I can go about debugging this?
I haven't slept a wink last night and it's now 11am - am getting an hour's shuteye, and would hugely appreciate any responses!
Thanks!
In Chrome's console you'll see
Resource interpreted as Script but transferred with MIME type
text/html:
"http://here-is.com/?dm=c078877dcf0e3101dc20cc337a8e4214&action=load&blogid=13&siteid=1&t=1522670393&back=http%3A%2F%2Fkentishtowner.co.uk%2F".
In fact, further digging shows that here-is.com is returning an empty response to that request.
The page is actually referring absolutely to a number of resources on here-is.com and that works fine when you access it via that domain, but has issues when you access via www.kentishtowner.co.uk. I don't know enough about your setup to say for sure how to resolve it but you probably need to configure the base URL of the project to tell it where it's being deployed, or if you can tell it to use relative links that would work too.
(In Chrome's developer tools you can hit ctrl+shift+F and type here-is.com to see the references)
Browsers have consoles where javascript errors are thrown. They will tell you what error was thrown, and where it was thrown from. Once you know that, you can google around to see if there is anything obvious to fix.
My guess, though, is that somewhere the site that isn't working is trying to use a script that was hosted on the working site. If that's the case, you just need to update the script paths.
--edit--
Fortunately for me (from what I hear), I have never used Wordpress. Unfortunately for you, I don't know how to tell you where the .js files would be located, or how they are organized at all.
I usually debug in Chrome, so this is how you can check to see if your page is able / unable to get an external script.
When you are focused on the page you're having a problem on, hit F12 to open up the dev tools in Chrome.
Click on the Network tab, and then hit F5 to refresh the page.
Click on the Type table header, and look for files that say text/javascript. Those will be the external script files your site is requesting.
Look at the Status column for each of those rows. If it doesn't say 200 OK., then your page isn't able to access the corresponding script.
From there, you would need to find where those scripts are supposed to be located. Once you know that, just find the scripts from the other site, and copy them into the correct location of the broken site.
Good luck!

Categories