Know-how js-base-href
From InfoCopter
[edit]
Perlbot 16:14, 25 July 2007 (CEST)
Page created at Wed Jul 25 16:14:17 2007 by Perlbot
[edit]
2.6.1 base href (since IE7)
Home > Know-how >
JavaScript > base href (since IE7)
| ← 2.6 JavaScript | [ up ] - [ top ] | 3 Databases (DBMS) → |
Get/Set <base href=""> with JavaScript?
Is it possible to get and set the <base href=""> tag in an HTML page with JavaScript? Even just to get the href would be helpful. Using a jump menu, the JavaScript does not seem to take the document base into consideration when processing links.
The answer at experts-exchange ist not useful at all. See this example instead:
<script language="JavaScript">
document.getElementsByTagName("base")[0].href = "http://www.example.com/know-how/mediawiki-reference/";
</script>
Please take note it's necessary to set an initial base href value if you want to modify its value at page
load time.
See also:
-
Tips and Tricks. - Reference
Know-how: JavaScript
Keywords: JavaScript, infoCopter
[edit]

