JavaScript file paths are relative to displayed page. How do I make JavaScript file paths relative to the current file directory?
For instance, I include a file sh/shThemeDefault.css into footer.php (there are under the same directory: wordpress/wp-content/themes/) by:
<script src="sh/shCore.js" type="text/javascript"></script>
While accessing a post (say http://example.com/post-A),
sh/shCore.js will be extended as http://example.com/post-A/sh/shCore.js, reporting not found error.
The right absolute path is http://example.com/wordpress/wp-content/themes/sh/shCore.js.
PS: I am installing SyntaxHighlighter by placing the following codes before /body in footer.php:
<link href="./sh/shCore.css" rel="stylesheet" type="text/css" />
<link href="./sh/shThemeDefault.css" rel="stylesheet" type="text/css" />
<script src="./sh/shCore.js" type="text/javascript"></script>
<script src="./sh/shAutoloader.js" type="text/javascript"></script>
<script type="text/javascript">
SyntaxHighlighter.autoloader(
['python', 'py', 'sh/shBrushPython.js'],
['java', 'sh/shBrushJava.js'],
['bash','shell','sh/shBrushBash.js'],
['css','sh/shBrushCss.js'],
['sql','sh/shBrushSql.js'],
['latex', 'tex','sh/shBrushLatex.js.js'],
['plain', 'text','sh/shBrushPlain.js'],
['php','sh/shBrushPhp.js'],
['js','jscript','javascript','sh/shBrushJScript.js'],
['xml', 'xhtml', 'xslt', 'html', 'xhtml','sh/shBrushXml.js']
);
SyntaxHighlighter.all();
</script>
<script src="sh/shCore.js" type="text/javascript"></script>encounters the same issue.