View Full Version : Dynamic Ajax Content issues in IE

10-23-2007, 02:33 AM
1) Script Title: Dynamic Ajax Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem:

First of all, this is a way, way cool script. I absolutely love it!

I have it installed and working great, except in IE7. It works when the page first loads in IE7, but if I menu to other pages in the site and then return - it stops working. I have to do a refresh to get the functionality back.

Any help would be most appreciated as I really do love this script!
You can see the site at www.serenityskincaresd.com/services.html

Thanks in advance for any help!

10-23-2007, 04:23 PM
hello? Anyone?

I would genuinely appreciate any help I can get!

10-23-2007, 11:38 PM
Ok, I have a friend who fixed this issue for me. I was doing an automatic load of one of the dynamic pages so that there would be content on the page before any menu item was clicked. He had me move that statement:
<script type="text/javascript">
ajaxpage('facials.html', 'contentarea') //load "facials.htm" into "contentarea" DIV
to the bottom of the page just before </body>.

Then he made some adjustments to the script which 100% fixed the issue with IE7.

Here is that updated script:

* Dynamic Ajax Content- Dynamic Drive DHTML code library (www.dynamicdrive.com )
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""
var page_request = false

function ajaxpage(url, containerid){
page_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
page_request = new XMLHttpRequest();
if (page_request.overrideMimeType) {
} else if (window.ActiveXObject) { // IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
page_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {};
if (!page_request) {
alert('Cannot create XMLHTTP instance');
return false;
loadpage(page_request, containerid)
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))

function loadobjs(){
if (!document.getElementById) return
for (i=0; i< arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref.setAttribute("src", file);
if (file.indexOf(".css")!=-1){ //If object is a css file
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
if (fileref!=""){
loadedobjects+=file+" " //Remember this object as being already added to page