Okay, this is similar, but not the same, to the 'How to detect when iframe src changes' question, because it is when the iframe wants to change. What I mean is, I have an iframe with Google in it (I just started working on a web-based OS because I was bored, check http://dextive.com/russellsayshi/os/ ) but the problem is google uses a header to block being displayed in iframes.
The way I got around it so far is by making a PHP page with this simple source (please forgive my PHP noobness):
<?php
echo "<base href='".$_GET['url']."'>";
$site=file_get_contents($_GET['url']);
echo $site;
?>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript">
$("a").click(function() {
var href = this.href;
var baseURL = "overridexframe.php?url=";
window.location = baseURL + href;
return false;
});
</script>
This works great, and having the iframe source set to overridexframe.php?url=(url goes here)
works great, until you try a search. As you can see above, I have jQuery fixing links, but when it tries to change it using javascript, it is not going to my specified override URI. Does anyone know a way to try and catch when an iframe tries to change, but can’t, so I can apply JS to it?