Path to javascript source code at local browsing


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Path to javascript source code at local browsing

Where should I put my javascript source code in order to run it "locally" by file not by http?---not sure this "locally" is the appropriate word here.
My test is when my javascript code (test.js) is put in the site default folder as the test.html in /var/www/html both worked as expected with http:
Code:
http://localhost/test.html

Code:
<script type="text/javascript" src="/test.js"> </script>

However, when I tried to test it at URL window with file:
Code:
file:///home/davids/study/WebTech/test.html

I can see my html result, but my javascript code was not executed.
Where should I put the external javascript source code (here:test.js) in order to test it "locally"?

Thanks!
# 2  
You need to supply the correct (relative or absolute) path to test.js. As given, the html script will look into the root directory (unless chrooted).
This User Gave Thanks to RudiC For This Post:
# 3  
Thanks!
Ahh, back slash "/" - that is the root!


Last edited by yifangt; 06-27-2017 at 05:13 PM..
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Migrate /export/home from storage path to local
Deeo
I am newbies in solaris, hope u guys can help me, I need to transfer /export/home directory that currently mount at storage and migrate into local disk. may i know the best way to do it? Thanks... Solaris
6
Solaris
Generate class path dynamically based on source path
oraclermanpt
Hi experts, I have multiple file names ending with .jsp located in $SOME_DIR, $SOME_DIR/f1/,$SOME_DIR/f2/test,$SOME_DIR/f3/fa and there are equivalent class files in $SOME_DIR/WEB-INF/classes/_pages,$SOME_DIR/WEB-INF/classes/_pages/_f1,...... Shell Programming and Scripting
0
Shell Programming and Scripting
Source path
Oggie25
what is the command for moving a file with it's original source path ?... UNIX for Dummies Questions & Answers
8
UNIX for Dummies Questions & Answers
Save page source, including javascript
locoroco
I need to get the source code of a webpage. I have tried to use wget and curl, but it doesn't show the necessary javascript part of the source. I don't have to execute it, only to view the source. How do I do that?... Shell Programming and Scripting
1
Shell Programming and Scripting