Here is the scenario:
I Have 3 files:
index.php:
<html><head>
<script type="text/javascript" src="../jquery.js"></script>
<script>
$(document).ready(function(){
$("#local").load("FarLinkLoader/farlink.php");
});
</script>
</head><body>
<div id='local'></div>
</body></html>
/FarLinkLoader / farlink.php:
<div>
<a href="farfar/farfarlink.php">farfarlink</a>
</div>
/FarLinkLoader / farfar / farfarlink.php:
text or whatever
The problem is that when the farlink.php is loaded into index.php the link within farlink.php becomes invalid, the reference of the link being from index.php and not from the former file.
Is there anyway around this? iframe was good at this, being actually a “browser” within a browser because the page that was being loaded through iframe had it’s neighbor files/directories referenced from there and not from the page within the former page was loaded as it happens in case of ajax requests.
What are the various possibilities of replacing this desired functionality?
Anticipated thanks!
I know you’ve said that “absolute URLs are not a solution”, but if all your files reside on the same server, you can use URLs that aren’t relative and aren’t absolute with a stated domain but are absolute to the root of your server and thus would always refer to the same file regardless of what page they are contained in. Just use a preceding “/” character and the full path from the root to each file.