Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1440 Is there anyway to dynamically set the BASE HREF to something if the page is loaded locally and somewhere else is loaded from online?

You are here: irt.org | FAQ | JavaScript | Link | Q1440 [ previous next ]

No. Even trying the following does not work, as Netscape Navigator adds another BASE tag before our own:

<html>
<script language="JavaScript"><!--
if (location.protocol == 'file:')
  document.write('<BASE HREF="file:///c:/mymaindir/subir">');
else
  document.write('<BASE HREF="http://something.com">');
//--></script>
<body>
....
</body>
</html>

©2018 Martin Webb