Solved

Javascript doesn't load

Posted on 2011-09-20
20
247 Views
Last Modified: 2012-05-12
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.





0
Comment
Question by:savsoft
  • 9
  • 6
  • 4
  • +1
20 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36571361
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?
0
 

Author Comment

by:savsoft
ID: 36571376
yes, these are at same folder. everything is working fine in firefox
no ajax call
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36571386
please check in the IE8 debugger, if the file is getting loaded or not
0
 

Author Comment

by:savsoft
ID: 36571388
javascript folder permission is 0775
is this have to change into 777
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36571390
dont think if this is the problem, since you said that it is working fine in ff
0
 

Author Comment

by:savsoft
ID: 36571406
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

0
 
LVL 13

Accepted Solution

by:
Hugh McCurdy earned 150 total points
ID: 36571422
Sounds like the server is running a *nix.  Try making a symbolic link from the actual javascript folder the same folder as index.php or a subfolder to that folder and see what happens.  I have a vague recollection of having a similar problem last spring sometime and moving the files seemed to solve it.  Might work for you too.
0
 

Author Comment

by:savsoft
ID: 36571456
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
0
 
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 36571474
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?
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36571543
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>
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:savsoft
ID: 36571653
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>
0
 

Author Comment

by:savsoft
ID: 36571655
IE is always create problem for developers :(
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36571659
hmm....so does it work with all the browsers now?
0
 

Author Comment

by:savsoft
ID: 36571713
yes work with firefox and chrome..
thanks for answering..
0
 

Author Comment

by:savsoft
ID: 36571716
can you please explain symbolic link
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 100 total points
ID: 36571722
how is <<symbolic link>> link relevant here?

check this anyways
http://kb.iu.edu/data/abbe.html
0
 
LVL 15

Expert Comment

by:Eyal
ID: 36572621
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
0
 
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 36572712
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.
0
 

Author Closing Comment

by:savsoft
ID: 36585472
Reason didn't find
0
 
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 36587128
Didn't find what?  Do you still need help?
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now