Path to javascript source code at local browsing

Tags
javascript, path, source, web

 
Thread Tools Search this Thread
# 1  
Old 06-27-2017
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  
Old 06-27-2017
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:
yifangt (06-27-2017)
# 3  
Old 06-27-2017
Thanks!
Ahh, back slash "/" - that is the root!


Last edited by yifangt; 06-27-2017 at 06:13 PM..

|
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 Solaris 6 12-21-2016 07:59 AM
Generate class path dynamically based on source path oraclermanpt Shell Programming and Scripting 0 12-19-2016 04:27 PM
I am trying to merge all csv files from source path into 1 file cplusplus1 Shell Programming and Scripting 0 06-06-2016 09:55 PM
Source code M K Raju UNIX for Dummies Questions & Answers 4 08-12-2015 10:51 AM
Set variable to path that does not exist on local host squrcles Shell Programming and Scripting 2 07-14-2014 02:35 PM
Source code neh Linux 1 10-13-2013 06:09 AM
Source path Oggie25 UNIX for Dummies Questions & Answers 8 11-30-2012 05:39 AM
SCP wihout a source path zlowryder UNIX for Advanced & Expert Users 6 03-12-2012 07:46 AM
How to use javascript code in unix shell? l_gshankar24 Shell Programming and Scripting 4 02-20-2012 03:52 AM
rpmbuild, how to specify a different source and destination path for files tiburblium Linux 0 02-18-2012 11:53 AM
Block of code replacement in Java source code through Unix script hareeshram Shell Programming and Scripting 2 01-30-2012 11:54 AM
Save page source, including javascript locoroco Shell Programming and Scripting 1 09-11-2011 01:34 PM
clear complex javascript code fed.linuxgossip Shell Programming and Scripting 6 07-24-2008 08:39 AM
source code for linux naren_chella Linux 2 03-07-2006 12:56 AM