I am using the HTML_AJAX package in PEAR (admittedly an old library, but it has worked fine for me for a couple of years and I don’t want to leave my infrastructure).
The problem I am having is that with the introduction of Firefox 4, and now also Firefox 5, JavaScript that is included in responses using HTML_AJAX.replace(div_target, request_page) [API is to replace div_target with the response from request_page] has stopped working.
It works fine on Chrome, IE9, Android, iPhone, etc. but not FF4/5.
Is this some sort of new feature, security mechanism, or just a plain old bug? If it’s a bug, is it a bug with HTML_AJAX (i.e. you can do it with jQuery?) or is this something FF needs to fix?
Example.
This page exists:
<script type="text/javascript" language="JavaScript">
function do_replace(){
HTML_AJAX.replace("something", "index.php?key=value"); // index.php will have html mixed with JS and paste it to the div "something".
}
</script>
<div id="something" onclick="javascript:do_replace()">This text is to be replaced</div>
And this is index.php:
BLA BLA BLA some text maybe a <div> or something
<script type="text/javascript" language="JavaScript">
alert("this has worked before, but stopped working on FF4&5 still works on Chrome Android etc.");
</script>
I tried finding the answer to this by searching but couldn’t find anything conclusive. I appreciate any help I can get on this.
BR Erik.
This is how I solved it.
Replace
With
in the 3 files