1

Have a look on this site: https://bm-translations.de/impressum-agb-datenschutz.php I am loading external scripts and sheets. Everything is working except the globaljs.js file. I cannot see errors. Its in the same directory as the site.

I uploaded it as text as well, so you can have a look on it: https://bm-translations.de/globaljs.txt

What am I doing wrong? I tried to implement the script in the head, as you can see, as well as at the end of the body. The JS works perfectly within the page, but as soon as I try to outsource it as external script, its not working anymore.

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="globalcss.css"> 

<meta charset="UTF-8">
<link rel="shortcut icon" href="./bilder/favicon.ico"/>
<link rel='dns-prefetch' href='//fonts.googleapis.com' />
<!--jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyload/1.9.1/jquery.lazyload.min.js"></script>
<script src="globaljs.js"></script>
3
  • 1
    Your server responded with a 403 for your globaljs.js file, which means "Forbidden". Commented Aug 11, 2017 at 5:02
  • I thought its just to protect the content of it, but now I guess its also making it not work, right? If so, I should consult my proivder. Commented Aug 11, 2017 at 5:08
  • bm-translations.de/globaljs.js shows 403 forbidden error. Did you grant read access to user www on that file? Commented Aug 11, 2017 at 5:10

1 Answer 1

1

Be sure your JavaScript file is in the same directory as the .html or .php file that is calling for the script.

For instance, if your directories look like this:

pages
  ..index.php
scripts
  ..globaljs.js

Your HTML would need to reflect the directory structure like

<script type="text/javascript" src="../scripts/globaljs.js"></script>

Without knowing your directory structure it is difficult to say.

Sign up to request clarification or add additional context in comments.

4 Comments

sorry I didnt mention, its in the same directory. I emailed the hoster, but it would be really strange, if they block JS Files by default, I think they are just hiding it for "visitors"
An you log in with FTP client such as FileZilla and check the permissions?
Thought is that your host might have cacheing on. You may need to turn off features like "super cachet" if using cPanel on your host. Similarly, sometimes your local cache may be affecting your view. To check the latter, open developer tools in Chrome and then click and hold refresh for option to refresh the local cache.
it was the caching and default of the htaccess. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.