View Full Version : Assigning the an entire document

06-19-2009, 07:02 AM
I am barely familiar with javascript. I have this html code with an embedded iframe. The html file in the iframe refreshes every once in a while. That is fine. However, in IE, there is this annoying click with every refresh.

I googled a bit and saw a few solutions. Seem to me that if I fetched the contents of the HTML file (AJAX call) and assigned it to existing document, I may get around the problem.

1. How do I assign an entire document in JS?

2. If I did this would this prevent the clicks?

Philip M
06-19-2009, 07:49 AM
1. How do I assign an entire document in JS?

2. If I did this would this prevent the clicks?


var str = document.getElementsByTagName('html')[0].innerHTML;
alert (str);

2. No idea. Try it.

Login?: yes
Password: i dont have one
password is incorrect

Login?: yes
Password: incorrect

06-19-2009, 08:24 AM
Thank you for your response. I am going to try it. However, I need a bit of a clarification. Perhaps, to begin with I should have posted the code where I am trying to do this. I am trying to get the contents from a URL with a synchronous AJAX call and then do the assignment. As I am not too familiar with JS the reverse assignment and the alert has me confused. Could you please explain this a bit. I have given below the code snippets.

This is what I currently have (which causes the click to occur)

window.location = myurl;

Here is what I am trying to do in a javascript function using AJAX

receiveReq.open("GET", myurl, false);
var response = receiveReq.responseText;

When the response comes back I need to replace the whole document, in a manner similar to an assignment


06-19-2009, 04:07 PM
The 'click' is a sound IE attaches to 'navigation complete' from a window or frame. It is user controlled, and is set or removed from the control panel sounds applet.

06-21-2009, 11:19 AM
I realize that the click is an IE thing as it does not happen in Firefox. However, one cannot expect the visitor (to one's site) to turn off this. I have not figured out how to replace entire document. I looked around for only a little while and could not find much.

I am thinking of going a different route. I will try and modify the code that generates the 'reload' HTML. If the reload is happening because of a refresh, I will try an return only part of the HTML that changed and use innerHTML to replace the content. This may be what I should have been doing to begin with. Hope this solves my problem.

However, I would still like to find out if there is any way one can replace the entire HTML using something like the innerHTML

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum