Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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?

irt.org | Knowledge Base | JavaScript | Link | Q1440 [ previous next ]

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?

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.