SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast BurakUeda's Avatar
    Join Date
    Apr 2005
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SOLVED -- External .js file won't load...

    Very strange, I am pulling my hair...
    Let me explain:

    This is the simple version of my website structure
    Code:
    top
    |
    |__[JS folder]
    |          |_____ main.js
    |
    |__[SUPPORT folder]
    
    |            |
    |            |___[JS folder]
    |            |           |_____ support.js
    |            |
    |            |
    |          index.php
    |             
    |__[SECURE folder]
    |             |
    |             |___[JS folder]
    |             |           |_____ secure.js
    |             |
    |             |
    |           index.php
    index.php
    And in my main index file (/index.php), I have this:
    HTML Code:
    <SCRIPT SRC="JS/main.js" LANGUAGE="JAVASCRIPT"></SCRIPT>
    between <HEAD> tags and it is working fine...


    In my secure index file (/secure/index.php), I have this:
    HTML Code:
    <SCRIPT SRC="JS/secure.js" LANGUAGE="JAVASCRIPT"></SCRIPT>
    and it is working fine too...


    Here comes the strange part:
    In my support index file (/support/index.php), I have this:
    HTML Code:
    <SCRIPT SRC="JS/support.js" LANGUAGE="JAVASCRIPT"></SCRIPT>
    it is NOT loading.

    - I am testing this in a local server, so file is there for sure.
    - When I copy and paste functions in support.js into main.js, and point "SRC" to the main.js (../JS/main.js) it LOADS! and fuctions are working...
    - It is between <HEAD> tags
    - No I don't use any <SCRIPT> tags in .js files
    - I am cleaning the cached files everytime I test.

    I also searched the web, there are some similar questions and the answer is:
    "HEY! it started to work suddenly, I didn't touch anything!"

    Anyone can see anything wrong?

    Thanks a bunch...
    Last edited by BurakUeda; Oct 22, 2005 at 11:01.
    H u m o
    Uncensored Forums for Intelligent People

  2. #2
    SitePoint Enthusiast BurakUeda's Avatar
    Join Date
    Apr 2005
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now this is funny.
    I have restarted my pc, and now none of the .js files are loading.
    This is something virtually impossible because I haven't touched the main index.php and secure/index.php for ages, and they worked fine without any problem. In the same environment, same PC, with same configuration, same firewall settings, same browser versions and settings etc. etc.

    What is going on??
    H u m o
    Uncensored Forums for Intelligent People

  3. #3
    SitePoint Enthusiast BurakUeda's Avatar
    Join Date
    Apr 2005
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And it is solved at last.
    I have found the problem but I still don't know what caused it.

    Here is a bit detailed explanation of what happened, in case this may help someone:
    I have opened Firefox Javascript console, to see what is happening. It was throwing a "Invalid Character Class Range" or something similar error before the page loads. So I have started to clean my javascript functions in .js file to find the responsible. But I received the same error message even after I have cleaned EVERYTHING in the file.
    So I suspected my php/html file which contains some onMouse... events, but they were allright.
    I have removed the <SCRIPT SRC....> link, and the error has gone!
    I have copied my main.js into support/JS/ directory, and renamed it to support.js. Erased everything in it, and re-coded the support.js functions. Voila! it worked!
    Somehow my .js file was corrupted in a strange way. Because it was viewable and editable. And editing-overwriting didn't correct the file.
    I just had to delete it an recreate it.

    Maybe someone knows the reason?
    H u m o
    Uncensored Forums for Intelligent People


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •