Hi All,
Didn't really know how to word that title. I'll summarise what my problem is, as someone may have a more elegant solution. I've just set up some 200 Wyse thin client devices. When they boot, the user gets a Kiosk mode IE8 (Or IE7, I don't recall :$) page which directs to the Citrix web interface.
Only problem is that these devices are Wireless and on many of them, the Wireless doesn't sort itself out quickly enough so the user gets a 404 and has to hit F5 to get the page.
What I want is a simple webpage, hosted locally on the devices, that will just say "Please wait..." or whatever, while checking for connectivity to the 'real' website. As soon as the real website is there, it redirects the user.
What would be the best way to do this? It needs to be mega simple in terms of number of files. Wyse has a horrendous scripting language, so the idea of copying over the JQuery libraries etc fills me dread. Not to mention the old IE issue! I'm stuck with IE as it has the best compatibility with Citrix's fancier features.
Any and all help much appreciated!
var ConnAttempts = 0 var $j = jQuery.noConflict() $j(document).ready(init) function init() { $j('body').append('<div id="status-msg"></div>') checkConnectivity() } function checkConnectivity() { $j('#status-msg').text('Trying to connect...') ConnAttempts++ var TargetUrl = 'http://whatever' $j.get( TargetUrl , handleUrlResponse ) function handleUrlResponse(data,status) { if (status == 200) { // Hooray! Lets go redirect location.href = TargetUrl } else { // Boo! Still not ready if ( ConnAttempts > MaxConnAttempts ) { $j('#status-msg').text('Received status '+status+' after '+ConnAttempts+' tries.') } else { $j('#status-msg').text('Please wait...') setTimeout( checkConnectivity , 300 ) // 0.3 seconds } } } }
<img alt="Connecting..." id="ImageTest" /> <script type="text/javascript"> $('#ImageTest') .error(function() { alert('Handler for .error() called.') }) .attr("src", $imageURL); </script>
function setImageUrl() { $('#ImageTest') .error(function() { alert('Handler for .error() called.') setTimeout( setImageUrl , 300 ) }) .attr("src", $imageURL); } setImageUrl()
function checkImageUrl() { $('#ImageTest') .error(function() { setTimeout("checkImageUrl()", 2000); }) $('#ImageTest').load(function() { window.location.replace(redirectURL); }); $('#ImageTest').attr("src", imageURL + "?=" + d.getTime()); } checkImageUrl();
You were right :D Just does nothing after the first event in IE, I guess changing the image url doesn't force a reload of the image.
I have, however, got it working by forcing a page refresh. I'll try and figure out how to get IE to reload the image because it's much cleaner, but at least I can make it work regardless.