Firefox: Can I use a relative path in the BASE tag?
- by Aaron Digulla
I have a little web project where I have many pages and an index/ToC file. The toc file is at the root of my project in toc.html. The pages are spread over a couple of subdirectories and include the toc with an iframe.
The project doesn't need a web server, so I can create the HTML in a directory and browse it in my browser. The problem is that I'm running into XSS issues when JavaScript from the toc.html wants to call a function in a page (violation of the same origin policy).
So I added base tags in the header with a relative URL to the directory in which toc.html. This works for Konqueror but in Firefox, I have to use absolute paths or the toc won't even display :( Here is an example:
<?xml version='1.0' encoding='utf-8' ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="../" target="_top" />
<title>Project 1</title>
</head>
<body>
<iframe class="toc" frameborder="0" src="toc.html">
</iframe>
</body>
</html>
This is file is in a subdirectory page. Firefox won't even load it, saying that it can't find page/toc.html.
Is there a workaround? I would really like to avoid absolute paths in my export to keep it the same everywhere (locally and when I upload it on the web server later).