Javascript won't load over network using MAMP? - javascript

I'm using MAMP for a local website, I have www.mywebsite.dev set up and everything works fine.
But when I try to access by 192.168.0.198 - my comp's IP, it will load the website fine, images, css and all. But it fails to load the javascript. I've checked the paths and all look fine - why would it load everything but JS??
(I need to use the IP to test over the network)
Thanks!

Thanks guys for the help, I managed to get it working by clearing the cache in my CMS's navigation section. Turned out one of the elements were not loading in quick enough. Cheers!

Related

page doesn't load css and js files after refresh

I have the problem that my site does not load some css and js files when refreshing the site. When I first call the site everything is fine, its just after refreshing.
http://www.benty-fields.com/
Its a bit hard to debug, since on my local host everything works fine, its just a problem on the server. I am using the free tier on AWS, but I can't find any discussion about such a problem in connection with AWS, so I guess its my site. Has anybody have seen such a problem before and can give me some tips how to resolve it?
carl
EDIT:
I use chrome Version 45.0.2454.101 (64-bit) when I get the error, but I seem to get similar errors on firefox.
The error will modify the website, since the css files are not loaded, but you can also seem them if you go to
View > Developer > Javascript console... you should see something like that
GET http://www.benty-fields.com/static/css/popbox.css 500 (Internal Server Error)
(index):192 GET http://www.benty-fields.com/static/js/spin.min.js
(index):185 GET http://www.benty-fields.com/static/js/moments.min.js 500 (Internal Server Error)
(index):191 GET http://www.benty-fields.com/static/js/bootstrap-select.min.js
It seems that website is working fine for me, please have a look into attached image and let us know your thoughts,
This is not a real solution to the problem, since I guess there is a solution on AWS itself, but for me the problem was solved by moving to digital ocean...
cheers
carl
If you're running Cloudflare, remember to clear its cache and enable development mode. This is something that used to nail me and waste hours of time when I first started running my sites through Cloudflare. Hope this helps someone.

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.

Zero ClipBoard issue

I am trying to integrate Zero Clipboard into tornado web application and I am running into some problems.
http://jonrohan.github.io/ZeroClipboard/#demo this page works perfectly, but when I try to view same page on my local machine ('Save page as..' to get all the files locally) after opening HTML file I get http://snag.gy/sT1y2.jpg . And this happens (same error) even if I do everything what is written in tutorial (only required lines of code).
Maybe some one had similar problem?
Thanks
I had the similar problem and I made it to work by uploading it to server where it worked fine.
Instead of testing it on local, please test it some where on server.

Javascript only works with ip after page refresh, before refresh access using dns works

I'm struggling with a weird problem.
All my document.ready functionality is working when using the web page by dns.
When switching to IP the functionality breaks, but starts working after a page refresh.
Have anyone encountered this phenomenon before?
I know this is vague and apologize beforehand.
Thanks for any help!
Update:
Script has been verified to be loaded at the time when functionality doesn't work
Based on your vague question, the only POSSIBLE idea I can come up with is that some Javascript you have is now being referenced by IP address http://127.0.0.1/scripts and the scripts directory is only available via the DNS named http://hostname/scripts.

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