The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> IE vs Other browsers executing javascrip, IE runs JS only once, while other browsers every time
Bob Miers
post Mar 10 2012, 09:08 AM
Post #1





Group: Members
Posts: 6
Joined: 10-March 12
Member No.: 16,677



I would be extremely grateful if you could cast your eye over the following problem and give me some advice if possible.

I have a WEB site index.html page (www.woodmereassociates.com) that uses the following code to read and
display a normal text file. (I found this code on the WEB)
It works as advertised, quite well, with all of the browsers (Foxfire,
Apple's, etc.) I've tested except with MS IE8 & IE9 and maybe earlier versions as well.

When I access the WEB page by entering the URL in the address line, I see the context of the text file as desired.
However if I navigate to any other page on the WEB site and then return to the Home Page (index.html),
the text file content is not shown.

My bypass is to use the text "id="dsp">Check with
one of our agents for Our Featured Listing particulars." text is used within the html code. (see code near the end).

Thinking that this might be a cache problem, I've tried several methods to make the browser not reuse cache, but to no
avail. ie <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

Any ideas?

If need be I can post the entire page.

Thanks, Bob Miers

<!--this is the beginning of the code to read a text file
-->
<!-- <meta http-equiv="content-type"
content="text/html;charset=utf-8" />
<title>An XHTML 1.0 Strict standard template</title>
<meta http-equiv="content-type"
content="text/html;charset=utf-8" />
-->
<script type="text/javascript">
//<![CDATA[
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope
with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
alert('!IE')
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}
xmlhttp.open("GET","featured.txt" ,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
document.getElementById('dsp').innerHTML=xmlhttp.responseText;
}
}
xmlhttp.send(null)
//]]>
</script>
<!--</head>-->
<!--<body>-->
<div>
<div>
<p align="justify" id="dsp">Check with one of our agents
for Our Featured Listing particulars.</p>
</div>
</div>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Christian J
post Mar 10 2012, 10:39 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



Seems to work in my IE emulator (all IE versions) when I put the p#dsp element before the script instead of after (you might also wrap the whole script in an onload event).

BTW it seems Chrome/Iron's and Opera's default settings don't allow offline AJAX file inclusion, their error consoles saying "Cross origin requests are only supported for HTTP" and "XMLHttpRequest to files is disabled for security reasons", respectively.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Bob Miers
post Mar 10 2012, 10:57 AM
Post #3





Group: Members
Posts: 6
Joined: 10-March 12
Member No.: 16,677



QUOTE(Christian J @ Mar 10 2012, 08:39 AM) *

Seems to work in my IE emulator (all IE versions) when I put the p#dsp element before the script instead of after (you might also wrap the whole script in an onload event).

BTW it seems Chrome/Iron's and Opera's default settings don't allow offline AJAX file inclusion, their error consoles saying "Cross origin requests are only supported for HTTP" and "XMLHttpRequest to files is disabled for security reasons", respectively.



Just so I'm clear in my posting. The text file shows up when the URL is put into the browser, however, when returning to the Home page after visiting any other page, the default text shows up.

Thanks for all of you for your help.

Bob miers
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Mar 10 2012, 11:08 AM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



Oh, I do see it! I must have missed it before. I see your fallback text also. Odd, I used Find and searched for one of the words and it wasn't there. Maybe I was clumsy and made a typo.

OK, so basically the script just includes the text? Or does it process it in some way? Because if it doesn't I'd use a normal include and don't have to worry about JavaScript and browsers.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 29th March 2024 - 10:44 AM