Solved

JQuery Code not Working on IE8

Posted on 2012-03-27
10
471 Views
Last Modified: 2012-04-12
Hello again all!

After some much needed help from an expert, I finally got some Javascript (JQuery) I was working on going in Firefox and Chrome. I go to test in the world's "best" browser, IE8 and it doesn't work at all. Here is the code.
<html>
<head>
<script script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script>
$(function() {
     $("#PrinterNames").change(function() {
         var printer = $(this).val();
        var url = "file:///C:/Users/JBenson/Desktop/Printer Scripts/Completed" + "/" + printer +".vbs";
        window.open(url,'Start Installation');
     });
});
</script>      

</head>

<body lang=EN-US style='tab-interval:.5in'>

<img src=inspirelogo.gif>

<h2>Welcome to the HK Printer Installation Page!</h2>
      <h3>Please select a printer:
            <select id ="PrinterNames"  name ="PrinterNames" >
		  <option value="Please Select a Printer" selected="selected">Please Select a Printer</option>
		  <option value="Acadia">Acadia</option>
                  <option value="Altima">Altima</option>
                  <option value="Armada">Armada</option>
                  <option value="Avalon">Avalon</option>
                  <option value="Blazer">Blazer</option>
                  <option value="Camaro">Camaro</option>
                  <option value="Caravan">Caravan</option>
                  <option value="Cavalier">Cavalier</option>
                  <option value="Celica">Celica</option>
                  <option value="Charger">Charger</option>
                  <option value="Chevelle">Chevelle</option>
                  <option value="Corolla">Corolla</option>
                  <option value="Corvair">Corvair</option>
                  <option value="Corvette">Corvette</option>
                  <option value="Daytona">Daytona</option>
                  <option value="Envoy">Envoy</option>
                  <option value="Escalade">Escalade</option>
                  <option value="Frontier">Frontier</option>
                  <option value="HHR">HHR</option>
                  <option value="Hummer">Hummer</option>      
                  <option value="Impala">Impala</option>
                  <option value="Insight">Insight</option>
                  <option value="Intrepid">Intrepid</option>
                  <option value="Journey">Journey</option>
                  <option value="Malibu">Malibu</option>
                  <option value="Maxima">Maxima</option>
                  <option value="Murano">Murano</option>
                  <option value="Neon">Neon</option>
                  <option value="Nomad">Nomad</option>
                  <option value="Nova">Nova</option>
                  <option value="Prowler">Prowler</option>
                  <option value="Sentra">Sentra</option>
                  <option value="Skyline">Skyline</option>
                  <option value="SSR">SSR</option>
                  <option value="Stratus">Stratus</option>
                  <option value="Versa">Versa</option>
                  <option value="Xterra">Xterra</option>
            
            </select> </h3>

<h3>Steps for Printer Installation </h3>
<ol>
      <li>Select your printer from the drop down above.</li>
      <li>You will get a pop up window that looks like this<br>
      <img src="printerinstall.jpg" alt="Download Box" ><br>
      Please click on open. It will iniate the installation.<br></li>
      <li>You may see a pop up box that looks like this during your installation<br>
      <img src="trustprinter.jpg" alt="Trust Printer"><br>
      Click on Install driver. <br></li>
      <li>After a few minutes, check your Devices and Printers and the printer you selected should now be there.</li>
</ol>
<h3>Please contact the helpdesk at 6657 if you encounter any issues. </h3>

</body>
</html>

Open in new window


I ran it through a fiddle someone created for me, and jslint on that doesn't find a single error. It runs great on Firefox and Chrome. Downloads a file I need the second I click on it.

I hate to be such a bother, but anyone have any ideas? Any reason IE would be so extremely picky?

I have also included a script file so if you wanted to test it in IE, you could.

Thanks Jami
Corolla.vbs
0
Comment
Question by:JamiBenson092279
  • 5
  • 5
10 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37774968
Is this for an intranet?
Where does the HTML live? On a web server or hard disk? Is the vbscript supposed to live on the hard disk?
I am frankly amazed it runs on any browser since it is highly suspect to execute a local script file.
Try the following:
1) put the web server the page runs on in trusted zone if that does not help,
2) save the html to hard disk and give it extension .hta for HTML application
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37775126
Very simple solution

Remove the space in the window name parameter

window.open(url,'Start_Installation');
0
 

Author Comment

by:JamiBenson092279
ID: 37776530
It is being tested on my local hard drive at the moment, but will actually run on a server once it is actually working like it's supposed to.  It all is just sitting on my desktop at the moment.  It is for our intranet yes.

I must have copied and pasted wrong since there is no space in the window name parameter.
 
 I tried changing it to hta as you had suggested. I get the same issue, It won't start the download. As a note, it was giving me an issue with the line(line 9 character 9) about opening a Window. I took it out and received the same issue as before.

Can you make any other suggestions?

Thanks for your time.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37777074
Yes there is

window.open(url,'Start Installation');

Remove the space from after the word start
0
 

Author Comment

by:JamiBenson092279
ID: 37777161
@mplungjan,

I now see that and apologize for not seeing that. I added the underscore. I am truly sorry apologize for that oversight and am sorry to have not seen that issue sooner. I will not make glaring mistakes like that again and then expect someone to correct them.

Even after making the changes you suggested it isn't working like it does in Firefox and Chrome. It pops up a window, like the jquery is telling it to, but it doesn't bring up the download box. I know IE, especially IE8, is very picky about syntax. Is there some reason that it would achieve the expected result in other browsers and not IE? Do I need to try different code instead to achieve the result I desire platform wide?

Thanks again and so sorry for my stupid, erroneous mistake.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37777323
No worries that can happen
I get the vb files in the browser as plain text in Firefox. No attempt of execution.
In ie8 I get a download or open dialog

This is on xp service pack 3

Seems that is the direct opposite of what you get
0
 

Author Comment

by:JamiBenson092279
ID: 37777344
That is odd!! I am using Windows 7 32 bit.

So very weird.....  

Is there a better way to do what I am trying to that may be more tolerant across all platforms? I originally was going to use an on click event to trigger the download, but I didn't know how to pass the value of the drop down box to the event. Do you think that I might be better off going this way?

Thanks again! Sometimes web programming and I just don't get along!

Jami
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 37777978
I just wrote this for another problem

Is that worth a try?

http://plungjan.name/test/testlink.html
0
 

Author Comment

by:JamiBenson092279
ID: 37839589
I really have to apologize about not getting back to you all about this. I could never get it to work so I tried something else similar and it works..... somewhat. We have been so busy the last couple weeks, I just haven't gotten the time to do anything.

I appreciate all the help you gave me though!

Jami
0
 

Author Closing Comment

by:JamiBenson092279
ID: 37839594
I never actually got this working, but you get the points for trying to help the noob! Thanks again!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now