Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1353
  • Last Modified:

Javascript executing slow in IE8

I have some javascript that appears to run very slowly when executed in IE8.  The script checks for which browser is being used, and then it builds the contents of a popup window accordingly. Here is a link to the site where the script is running:

http://www/trafficcam.aspx?ekmenu=cam&id=traf

How can I fix this slow-down?  Let me know if I need to provide any additional info.  Thanks for reading.
<script language="javascript" type="text/javascript" >

        function camName(camnumber) {
            switch (camnumber) {
                case 1:
                    camname = "Broad & Mercury";
                    break;
                case 2:
                    camname = "Broad & Church";
                    break;
                case 3:
                    camname = "Broad & Main";
                    break;
                case 4:
                    camname = "Broad & West College";
                    break;
                case 5:
                    camname = "I-24 & Old Fort";
                    break;
                case 6:
                    camname = "Old Fort & Chaffin";
                    break;
                case 7:
                    camname = "Old Fort & Bridge";
                    break;
                case 8:
                    camname = "Old Fort & Kings Hwy";
                    break;
                case 9:
                    camname = "NW Broad & Monte Hale";
                    break;
                case 10:
                    camname = "NW Broad & Thompson";
                    break;
                case 11:
                    camname = "Memorial & Lokey";
                    break;
                case 12:
                    camname = "Memorial & Clark";
                    break;
                case 13:
                    camname = "Memorial & Northfield";
                    break;
                case 14:
                    camname = "Church & CSX RR";
                    break;
                case 15:
                    camname = "Church & Middle Tennessee Blvd";
                    break;
                case 16:
                    camname = "Church & I-24";
                    break;
                case 17:
                    camname = "Church & Warrior";
                    break;
                case 18:
                    camname = "Church & Calumet";
                    break;
                case 19:
                    camname = "Church & Barfield";
                    break;
                default:
                    camname = "";
                    break;
            }
            return (camname);
        }

        function camOpen(camnumber, camactive) {
            if (typeof camwin != 'undefined') { camwin.close(); }
            camwin = window.open("", "Camera", "toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=370,height=280");
            var vidserv = Math.round((camnumber / 4) + .49);
            var cam = camnumber % 4;
            if (cam == 0) { cam = 4; }
            var ImageResolution = "352x240"; var DisplayWidth = "352"; var DisplayHeight = "240";
            var File = "axis-cgi/mjpg/video.cgi?resolution=" + ImageResolution + "&duration=60";
            var output = "";
            var nooutput = "";
            var camname = camName(camnumber);
            var Camera = cam;
            
            var BaseURL = "http://traf" + vidserv + ".murfreesborotn.gov/";
            if (Camera != "") { File += "&camera=" + Camera; } output = '<html><head><title>Camera ' + camnumber + '</title></head><body><font size="2" face="Verdana, Arial, sans-serif"><STRONG>' + camname + '</STRONG></font><br>';
            if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.platform != "MacPPC") && (navigator.platform != "Mac68k")) {
                output += "<OBJECT ID=\"CamImage\" WIDTH="
                output += DisplayWidth;
                output += " HEIGHT=";
                output += DisplayHeight;
                output += " CLASSID=CLSID:917623D1-D8E5-11D2-BE8B-00104B06BDE3 ";
                output += "CODEBASE=\"";
                output += BaseURL;
                output += "activex/AxisCamControl.cab#Version=1,0,2,15\">";
                output += "<PARAM NAME=\"URL\" VALUE=\"";
                output += BaseURL;
                output += File;
                output += "\"> <BR><STRONG>Axis ActiveX Camera Control</STRONG><BR>";
                output += "The AXIS ActiveX Camera Control, which enables you ";
                output += "to view live image streams in Microsoft Internet";
                output += " Explorer, could not be registered on your computer.";
                output += "<BR></OBJECT>";
            }
            else {
                output = "<IMG SRC=\"";
                output += BaseURL;
                output += File;
                output += "&dummy=garb\" HEIGHT=\"";
                output += DisplayHeight;
                output += "\" WIDTH=\"";
                output += DisplayWidth;
                output += "\" ALT=\"Moving Image Stream\">";
            }
            output += "</center></body></html>"
            nooutput += "<center><html><table><tr><td style=\"color:red;\">This video is currently unavailable.</td></tr></table></html></center>";
            
            if (camactive == 0) { camwin.document.write(nooutput); }
            else {
                camwin.document.write(output);
            }
        }
    </script>

Open in new window

0
thedeal56
Asked:
thedeal56
  • 8
  • 6
  • 2
  • +1
1 Solution
 
Gurvinder Pal SinghCommented:
0
 
gksinghietCommented:
In a nutsell you have to run folloing command from command prompt and restart your system:
regsvr32 actxprxy.dll

Unfortunatelly you cannot tell this to your users.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
thedeal56Author Commented:
Thanks for the fast replies.  I checked out your suggestions, but they appear to focus on the client side.  I was hoping there would be a way that I could alter my script to make it run faster.  If this is a browser problem and not script related, then I guess I'll just have to let it go.  What do you think? Should I totally rule out a scripting solution?
0
 
thedeal56Author Commented:
Just for the record, I tried out regsvr32 actxprxy.dll, and it's still slow.  
0
 
gksinghietCommented:
try to print timestamp before and after the method to see which one is taking more time
0
 
thedeal56Author Commented:
After looking at it a bit more, I noticed that the problem seems to be with the actual opening of the popup window.  I searched around on this specific issue, and others seem to have experienced it.  I will post back when I know more.
0
 
thedeal56Author Commented:
I tried just running this in IE8, and the new window was slow to open.  Would you mind running that script to see if you get the same problem?

<script>
window.open();
</script>
0
 
leakim971PluritechnicianCommented:
hello thedeal56

Try :

<script>
alert("Fast!");
window.open("http://www.google.fr");
</script>

Regards
0
 
thedeal56Author Commented:
The alert pops up fast, but the window opening is still slow.
0
 
leakim971PluritechnicianCommented:
Remove you antivirus or antimalware and do a new test. You have a filter somewhere blocking internet traffic or popup window.
0
 
thedeal56Author Commented:
I'm not exactly sure what you mean.  I am able to see the window after after a shot period of time, so it's not being blocked.  I could see if maybe I had something doing a preliminary scan on all pop-up windows, but this would have to be something specific to IE8, because everything works fine in Firefox/Chrome.  In any case, I did disable my antivirus and I still got the same result.  
0
 
thedeal56Author Commented:
If you guys just make an html file and put this in it:

<script>
window.open();
</script>

Does the window open fast for you?  
0
 
leakim971PluritechnicianCommented:
Why : window.open();
And not :
window.open("http://www.google.fr");
or any other URL ?
0
 
leakim971PluritechnicianCommented:
Work VERY fast on IE8 for me. Don't just disable your antivirus, if possible remove it. What antivirus do you have ?
0
 
leakim971PluritechnicianCommented:
Disable Popup blocker to : http://support.microsoft.com/kb/843016
0
 
thedeal56Author Commented:
Sorry for the delay.  I'll answer your last posts in order:

I was just using a blank window as an example.  For me, it didn't matter if I put an actual URL; it was still slow.  

I tried it on a machine that did not have any antivirus on it, and it was still slow.  Trend Micro is the antivirus on my work machine.

I'll try disabling the popup blocker first thing tomorrow.  

It does sound like this problem will not be able to be resolved by simply altering the script a bit.  Especially since the window is opening fast for you.  The window open delay is only a couple of seconds, and it does still do what it's supposed to do once it pops up.  I think I'll just chalk this one up to my OCD and move on.  I really appreciate all the help on this.  
0
 
leakim971PluritechnicianCommented:
Thanks a lot for the points and your feedback!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 8
  • 6
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now