CodeIgniter Forums

Full Version: Javascript doesn't work after moving installation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've installed CodeIgniter on a shared hosting without ssl certificate, which worked perfectly fine. Today I've moved the installation to the private_html directory. This works as one would expect, all files are loaded fine, and work as they should, but the javascript files don't seem to work. The files are correctly loaded, but they don't do anything (which I find very strange). Does anyone recognize the problem and know the solution?

Regards, Folkert
When you say they don't do anything...can you be more specific (JS errors? are you using browser developer tools to verify that the JS is not working?)? My first thought is to check the priviledges of the JS directory and files.

check the console in brower that you have get any errors regarding JS and also check the Code that you have mentioned the JS directory path and check that wheather it's loaded propely.
If your using Chrome web browser then it will ERROR on everything without https://

Thank you very much for your reactions. I do indeed get some errors in the console that do not occur in the not-ssl version.
When i replace the files with a cdn version and remove the custom.js file, the errors do not occur, but the functionalities still don't work.

GET 404 ()
jquery.min.js:3 Uncaught SyntaxError: missing ) after argument list
bootstrap.min.js:7 Uncaught SyntaxError: Invalid or unexpected token
icheck.min.js:6 Uncaught TypeError: Cannot read property 'fn' of undefined
   at icheck.min.js:6
   at icheck.min.js:11
(anonymous) @ icheck.min.js:6
(anonymous) @ icheck.min.js:11
custom.min.js:2 Uncaught SyntaxError: Unexpected token ?


the files are loaded correctly when i check the source-code in the browser. However, all functionalities that work with js, like dropdown menu's etc, do not work. I've tested this by adding alert('test') to the js file, which wasn't shown. when i write the alert directly in the <head>, it is shown, so you're probably right about the privileges. Do you have any idea about how to fix this?



Check the permissions of your JS files and directories. If these are the public files then I would think the permissions should be 755 for the directories and files.

NOTE: for directories I would not go higher then 775 unless you need to write to the directory which it would then be 777

I assumed that you are FTPing your files to the server. If this is the case and you are using a tool like filezilla then checking the permissions of the directories and files are as easy as clicking once on the file or directory and selecting file attributes.
See what @InsiteFX wrote. And I'll add that's not limited to Chrome.

Non-TLS links are nowadays treated as unsafe by default, so any plain-http linked resources will be blocked on a site loaded via https (that includes hard-coded links within JS too).