Page 1 of 1

Javascript and Firefox

PostPosted: Mon Dec 13, 2004 1:12 am
by BigWillyStyle42
I'm playing around with some Javascript and I've run into a pretty serious performance problem.

Code: Select all
function checkForED2KFile(e)
{
  if(!e) return false;
  if(/^http:\/\//.test(e.originalTarget))
  {
    HTTPrequest = new XMLHttpRequest();
    HTTPrequest.open("GET", e.originalTarget + ".ed2k", false);
    HTTPrequest.send(null);
    if(/^ed2k:\/\//.test(HTTPrequest.responseText))
    {
      e.preventDefault();
      e.stopPropagation();
      edUtil.downloadFile('"' + HTTPrequest.responseText + '"');
    }
  }
}


When HTTPrequest.send(null) is called firefox's CPU usage grows to 100% until the request has its response. In most cases you'd never notice because you'd have the response in less than a second, but if you've got any latency problems with your internet connection you're going to notice almost instantly. I'm wondering if anyone else has come across something like this or knows of a different way of getting a file via Javascript so as to perhaps sidestep this issue entirely.

To see an example you can visit: http://www.bigwillystyle42.com/scripts/index.htm

The one link is for http://www.bigwillystyle42.com/files/mf ... erator.exe so the script will try to download http://www.bigwillystyle42.com/files/mf ... r.exe.ed2k both of which are valid.

Re: Javascript and Firefox

PostPosted: Wed Dec 10, 2008 8:26 am
by tulipa
How do I turn Javascript on using Mozilla Firefox? When I go on YouTube, it gives me a message that says you either have Javascript turned off or you have a older version of Flash Player. I've tried going to Tools>Options, but it says Javascript is enabled and still it won't work. Someone help!

Re: Javascript and Firefox

PostPosted: Fri Jan 30, 2009 6:30 am
by Monalisa
Let me check your script first only then i will be able to tell you something