IE7 issue

May 9, 2008

The Last couple of hours I had an issue regarding the support of my asp application in IE7. I could find the issue when I was trying to access the application from IE7. It was pretty clear that the Thread switching was not working in IE7. Below, I have mentioned the code that works fine in IE6 and not in IE7:

function fnFlash(intMilliSecs)
{
var dlgScript = ‘window.setTimeout(’ +’ function () { window.close(); }, ‘ + intMilliSecs + ‘);’;
var result = window.showModalDialog( ‘javascript:document.writeln(’ + ‘”<script>’ + dlgScript + ‘<’ + ‘/script>”)’);
}

For which I was given the following code snippet by my Tech. Lead:

 <script>
 function msgIsIE(){
  var browser = navigator.appName;
  return browser == "Microsoft Internet Explorer";
 }

 function msgSendToServ(url){
  try{
   var http = msgCreateObject();
   var url = url;
   http.open("GET", url, false);
   http.send(null);
   return http.responseText;
     }catch(ex){throw ex;}
 }  
 function msgCreateObject(){
  var object;
  if(msgIsIE()){
   object = new ActiveXObject("Microsoft.XMLHTTP");
  }else{
   object = new XMLHttpRequest();
  }
  return object;
 }
 var start = new Date();
 sleep(500);
 alert((new Date()) - start);

function sleep(ms){
msgSendToServ("http://localhost:1111/dyn/sleep?ms="+ms);
 }
 </script>

Later I came to know that fnFlash() was actually a hack for the sleep functionality since there is no sleep function in javascript. Which doesn’t work anymore. And the script above is one of the other ways to circumvent the problem. The only problem with the script is that, this would increase your network traffic a bit. The url http://localhost:1111/dyn/sleep?ms=500 does a Thread.sleep(1000);Due to the network delay, the time out might take slightly greater time than 500 ms.Cheers!!!

Entry Filed under: Java script, Tips & Tricks, XML. Tags: , , , , , , .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Categories

Links

Calendar

May 2008
M T W T F S S
« Apr   Jun »
 1234
567891011
12131415161718
19202122232425
262728293031  

Recent Posts

Archives

Meta

Tags