I have a lab management webapp that lists servers on my network. With a click in IE I can open a terminal services session to that server.

The code - shown below - works in IE, but not in chrome or firefox. Can anyone suggest how I can make this work in Chrome (Firefox would be nice too, but Chrome is more important.)

I fooled around with an idea to do it with jquery, but couldn't make it work. I do have jquery loaded, though.

<span style="color:blue;cursor:hand;" onClick="runApp('mstsc /v 10.1.2.3'); return false;" title="Click to open Terminal Services session">HOSTNAME</span>

Would appreciate any advice. This has crippled an otherwise very useful tool.

Member Avatar for LastMitch

@scaiferw

The code - shown below - works in IE, but not in chrome or firefox. Can anyone suggest how I can make this work in Chrome (Firefox would be nice too, but Chrome is more important.)

Can you post your code regarding with runApp() function.

The runApp() code is in my original post above.

The alternative I've been looking at is a jquery setup where the HTML code is:

<span class="tsconnect" device_ip="10.1.2.3" style="color:blue;cursor:hand;" title="Click to open a Terminal Services session">[LBPDMPKW01]</span>

and the javascript code is;

$(document).ready(function() {
  $(".tsconnect").click(function () {
    alert("hello");
    //  runApp($(this).data("device_ip"));
    //  alert($(this).data("device_ip"));
    //  runApp("ping -t 127.0.0.1");
    //  runApp("mstsc /v 10.1.2.3"); return false;
    //  runApp("c:\temp\temp.cmd"); return false;
  });
}); 

I can't get any of the commented runapp() or alert() lines to run, though I know the function is firing because the uncommented alert("hello"); line works whenever I click on the spanned text.

Member Avatar for LastMitch

I can't get any of the commented runapp() or alert() lines to run, though I know the function is firing because the uncommented alert("hello"); line works whenever I click on the spanned text

Instead of click()

$(".tsconnect").click(function () 

Try using on() function:

$(document).ready(function() {
$("tsconnect").on("click",function(){
alert("hello");
runApp($(this).data("device_ip"));
alert($(this).data("device_ip"));
runApp("ping -t 127.0.0.1");
runApp("mstsc /v 10.1.2.3"); return false;
runApp("c:\temp\temp.cmd"); return false;
});
}); 

I'm not sure it's gonna work because this doesn't look right inside of runApp() & alert():

$(this).data("device_ip")
ping -t 127.0.0.1
mstsc /v 10.1.2.3
c:\temp\temp.cmd

Try to put 3 alerts and see how it goes. Put like one word in each alert.
If all 3 alerts appear then there's something wrong with

$(this).data("device_ip")
ping -t 127.0.0.1
mstsc /v 10.1.2.3
c:\temp\temp.cmd

So there's nothing wrong with the function runApp() & alert()

You need to find another way to make it readable so that runApp() & alert() function can read it and work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.