cancel
Showing results for 
Search instead for 
Did you mean: 

Java-based RDP Client

ryandgr_
Occasional Contributor

Java-based RDP Client

Hi All,

I've been at this for a good amount of time and figured I'd share my solution with the community. There's a good amount of talk about what RDP client to use, the applet code to use, how to get full screen to work, etc. I've been through this forum over and over looking for solutions to the full-screen issue, but never found a viable solution. I came up with something using JavaScript that isn't a true full-screen implementation, but it does leverage JavaScript to obtain the source workstation's resolution which in turn passes that in the parameter to the RDP client. If anyone has a better way, I'm all ears. Last I heard, there's no full-screen switch via the param fields, which I'd totally dig.

RDP Client

I've had the most luck with Elusiva RDP since it supports various keyboard shortcuts that ProperRDP does not. I believe it is basically built from ProperRDP, which is built from rDesktop. I've also messed with JRDesktop which is far behind the prior.

The Code

<script type="text/javascript">
function getResolution() {
var yourRes = screen.width + 'x' + screen.height;
document.write('<param name="geometry" value="' + yourRes + '">');
}
</script>
<applet code="com.elusiva.rdp.applet.RdpApplet.class"
codebase="<< CODEBASE >>"
archive="JavaRDP14-1.1.jar"
width="640"
height="480"
name="ElusivaRDP"
align="top">
<param name="code" value="com.elusiva.rdp.applet.RdpApplet.class">
<param name="codebase" value="<< CODEBASE >>">
<param name="archive" value="JavaRDP14-1.1.jar">
<param name="cabbase" value="">
<param name="name" value="ElusivaRDP">
<param name="align" value="top">
<param name="username" value="<<USER>>">
<!-- <param name="password" value=""> -->
<param name="Server" value="<<HOST>>">
<param name="Port" value="<<PORT>>">
<script type="text/javascript">getResolution();</script>
</applet>

I've seen various snipets of code that include the HTML, BODY tags, etc... but if you look at the actually end-result source code, they already build that around the applet import so it is not necessary here (I think how they build the page is totally ridiculous to be honest, but that's for another thread).

Basically what I've done is create a JavaScript function that reads the user's screen resolution, and writes an applet parameter using the geometry name and a value of the acquired screen resolution. While this isn't a true full-screen result, it does a decent job getting close. At the very least, it resolves the Desktop vs. Laptop vs. Tablet issue of hard-coding a specific resolution.

If anyone has anything that works better for them in regards to the full-screen issue, I'd be interested in hearing.

Thanks

9 REPLIES 9
ryandgr_
Occasional Contributor

Re: Java-based RDP Client

A new one... on some OS's you can't drag the window offscreen, making any toolbars a problem. This one uses your screen's width, but sizes down the height.

<script type="text/javascript">
function getResolution() {
var heights = new Array('480','600','624','640','720','768','800','864','900','960','1024','1050','1080','1152','1200','1280','1392','1400');

var w = screen.width;
var h = screen.height;
var yourRes = w + 'x' + h;

var hIndex = heights.indexOf('' + h + '');

if (hIndex < 0) {
alert('Your resolution is ' + yourRes + ', however the VPN is not setup for it. Please contact the x department with this information and they will add it. You can continue using the default resolution if you wish.');
} else {
var dSize = 0;
var heightArrayIndex = heights.indexOf('' + h + '');
var nextArrayIndex = heightArrayIndex - 1;

while (dSize < 79) {
var heightSize = heights[heightArrayIndex];
var newSize = heights[nextArrayIndex];

dSize = heightSize - newSize;
nextArrayIndex--;
}
document.write('<param name="geometry" value="' + w + 'x' + newSize + '">');
}
}
</script>

<applet code="com.elusiva.rdp.applet.RdpApplet.class"
codebase="<< CODEBASE >>"
archive="JavaRDP14-1.1.jar"
width="640"
height="480"
name="ElusivaRDP"
align="top">
<param name="code" value="com.elusiva.rdp.applet.RdpApplet.class">
<param name="codebase" value="<< CODEBASE >>">
<param name="archive" value="JavaRDP14-1.1.jar">
<param name="cabbase" value="">
<param name="name" value="ElusivaRDP">
<!-- <param name="align" value="top"> -->
<param name="username" value="<<USER>>">
<param name="Server" value="<<HOST>>">
<param name="Port" value="<<PORT>>">
<script type="text/javascript">getResolution();</script>
</applet>

manoj212_
Not applicable

Re: Java-based RDP Client

Ryan,

This is excellent. One question, is it possible to reduce the screen draw lag? I am not sure if there are parameters similar to the MS remote desktop client, like bitmap cacheing,

Thanks

Marshy_
Occasional Contributor

Re: Java-based RDP Client

Whoa, that's way more engineering than I could be bothered with Smiley Happy

I took the easy way out, and added this:-

<script language="javascript">
document.write('<param name="geometry" value="' + (screen.width - 16) + 'x' + (screen.height - 128) + '">');
</script>

after my last <param name= in the HTML.

I think it's what we classily refer to, here in the UK, as a bodge. But it is at least pseudo-full-screen, with a fudge-factor for keeping the user's main taskbar/dock somewhat visible, and not-quite-hitting the screen edge.

Just throwing it out there in case anyone wants something that requires less helpdesk ticketing Smiley Happy

--Chris

ozmark_
Occasional Contributor

Re: Java-based RDP Client

Timing is amazing; I was just asked if the RDP client could be expanded to include the /span directive, I was about

to log a Juniper ticket for enhancement.

Two questions, does your method cover this ? and can you just give some simple steps (Im new to SA) as to how

the HTML is processed by the SA to replace the various tags with actual values Smiley Embarassed

Mark

Marshy_
Occasional Contributor

Re: Java-based RDP Client

Mark, I'm assuming your questions were directed at me, so...

First off, no it doesn't seem to emulate the /span argument to mstsc. This is most likely due to the fact that my browser (Firefox) is using the current monitor's dimensions to populate the values fetched in that little Javascript segment.

Secondly, the HTML fragment that you supply on the resource profile page is wrapped (and stored as a string) in Javascript. Before being sent to the browser, the "<<THING>>" tokens are substituted for corresponding real values. The HTML is then written out into the page body - still using Javascript - for the browser to actually render. Someone who's a real web author can explain all that using the proper terms - I'm just a hacker Smiley Happy

I'm not completely clear, however, on why Javascript is used in this way, instead of values being directly transposed into the stored HTML fragment before sending it to the browser. (Edit: thinking about it, I wonder if it's to reduce the risk of something server-side mashing the HTML in some undesirable way?)

I'm also not clear on why the resource profile page suggests you have parameters like <WIDTH> and <HEIGHT> available, when this seems patently not to be the case... Hey ho.

ESpa_
Occasional Contributor

Re: Java-based RDP Client

This had brought things forward a lot. Now to get this thing talking with my Windows 2008 servers...

tnoppe_
New Contributor

Re: Java-based RDP Client

We successfully integrated the (non free) java RDP client from HOB in our JSA setup.

It works with automatic rewriting, we offer it as a web bookmark.

It is used by our employees that have a non-windows computer at home.

We even have bidirectional audio possibilities that way.

jkopko_
Occasional Contributor

Re: Java-based RDP Client

tnope...Can you elaborate at all? What specific piece did you get from HOB and how is it setup within Juniper?

I had a conversation with Juniper Engineering and they mentioned an official partnership type of integration with HOB, but details have been hard to come by.

King_Kev_
Not applicable

Re: Java-based RDP Client

Hi,

I'm new to these forums but I'm now beginning to see how great they are.

On the subject of Java based RDP clients, does anyone have an issues with the speed of the connections.

I find that display updates can be pretty slow.

I'm using:

PropperJavaRDP1.1-FullScreen and I'm doing this from a Mac connected to a 6Mbps broadbankd link.

I've also tested HOBLink as part of the IVE integration and this works brilliantly.

So are any of the other clients close to the speed of HobLink's

Our budget won't allow for purchasing an RDP cleint add-on that's quite pricey. Bearing in mind we've just had to fight to get our SA4000 upgraded to SA4500s.

Thanks