Link to home
Start Free TrialLog in
Avatar of savsoft
savsoftFlag for India

asked on

Javascript doesn't load

Hi,

i have two folder "javascript" and "admin"
a index.php file is placed in "admin" folder and "editor.js" file is placed in "javascript" folder

now i am calling javascript in index.php file with

<script type='text/javascript' src='../javascript/editors.js'></script>

it doesn't load javascript "editor.js" in IE 8  but if i place editor.js file in admin folder then it works fine.





Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

are these folders 'admin' and 'javascript' at the same level (siblings to each other)?
is this PHP file being used in an ajax call or it will render the page by itself?
Avatar of savsoft

ASKER

yes, these are at same folder. everything is working fine in firefox
no ajax call
please check in the IE8 debugger, if the file is getting loaded or not
Avatar of savsoft

ASKER

javascript folder permission is 0775
is this have to change into 777
dont think if this is the problem, since you said that it is working fine in ff
Avatar of savsoft

ASKER

debugger gives error "Object expected"
line in index.php is
<a href="#" onmouseover="mopen('m4')" onmouseout="mclosetime()">Test/Quiz <img src="../images/arrow.png"></a>
       
highlighted word is mopen('m4')
which is defined in javascript file

ASKER CERTIFIED SOLUTION
Avatar of Hugh McCurdy
Hugh McCurdy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of savsoft

ASKER

yes its work if i placed javascript file in same folder where index.php is placed and also if i placed javascript file in subfolder
That's good.  Is this a solution for you or do you need more help?  If you need more help --

What is the operating system on the server?
Do you understand how to make a symbolic link?
but if you put javascript file folder at the same level as admin folder, then it doesn't work?

even if you do this

<script type='text/javascript' src='../../javascript/editors.js'></script>
Avatar of savsoft

ASKER

it doesn't work with
<script type='text/javascript' src='../javascript/editors.js'></script>
<script type='text/javascript' src='../../javascript/editors.js'></script>

but work with

<script type='text/javascript' src='javascript/editors.js'></script>
<script type='text/javascript' src='editors.js'></script>
Avatar of savsoft

ASKER

IE is always create problem for developers :(
hmm....so does it work with all the browsers now?
Avatar of savsoft

ASKER

yes work with firefox and chrome..
thanks for answering..
Avatar of savsoft

ASKER

can you please explain symbolic link
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
next time try to use some kind of network monitoring tool (for example fiddler) to see what is the browser requesting from the server.
in firefox you can use firebug and the net tab
gurvinder372, symbolic link can be used to solve the problem or at least a problem similar to the one described (if I add to the problem a bit).

Let's say I have a lot of legacy software that uses a folder right where it is but I have new software that won't but insists that the folder be in the current folder or in a descendant subfolder of the current directory.  A symbolic link allows us to have a folder in "two places at once" and that's just what we need to solve the problem I described.  If we don't or won't have other software that needs the folder where it is now, then we can just move the folder.  But if the folder needs to be 2 or more places at once, symbolic links solve it.

OK, let's say you have these folders
images
javascript
pages

Inside pages you have index.php or index.html and IE won't let you access ../javascript/foo.js but will let you access javascript/foo.js if it exists. You can create a symbolic link from ../javascript to the current folder so that accessing javascript/foo.js will work

This works in a *nix operating system such as Linux, FreeBSD, etc.  It might work in some Microsoft O/S's too but that's outside my experience.  Assuming Linux, if we are currently in the "home" folder the command would be

$ ln -s javascript  pages/javascript

(You don't really need the second javascript but I like it.)

Then you check to make sure it worked

$ ls -l pages
and look for javascript.  It should say something like   javascript -> ../javascript

Sometimes this doesn't work out as well as it seems it would.  In that case, I use the full paths, ie

$ ln -s  /var/htdocs/javascript  /var/htdocs/pages/javascript
That almost never fails to get the job done.
Avatar of savsoft

ASKER

Reason didn't find
Didn't find what?  Do you still need help?