There's only one jQuery library, and it's one 30KB file, and it makes this so simple compared to what it would be (especially since I can't be arsed looking up the specifics of IE's XHR stuff).
Besides, you don't even need to copy files. Just convert it to base64 and use the data protocol direct in the HTML. Like in the attachment.
And then do something like this:
javascript code:
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
}
}
}
}
Which is untested because I'm lazy, but unless I've made any stupid mistakes it should do what you want.
EDITED: 3 Sep 2011 12:19 by BOUGHTONP