You could use the XMLHTTPRequest Javascript Object...you can embed it into a javascript function on an HTML page, and call it onLoad.
The object could request a PHP page on the server that would execute the code you need.
Here's some code I executed onClick...same idea...it calls a PHP page that executes code transparent to the user.
function loadXMLDoc(url)
{
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send();
}
}
}
function openLocation(lid){
var obj = eval("document.getElementById('div"+lid+"')");
var req = false;
if(window.XMLHttpRequest){
req = new XMLHttpRequest();
}
else
req = new ActiveXObject("Msxml2.XMLHTTP");
var url = "http://www.mywebsite.com/sessionGallery.php";
if(obj.style.display == "none"){
url = url + "?gallery_id=" + lid + "&view=true";
obj.style.display = "";
req.open("GET", url, true);
req.send(null);
}
else{
url = url + "?gallery_id=" + lid + "&view=false";
obj.style.display = "none";
req.open("GET", url, true);
req.send(null);
}
}