PDA

View Full Version : send parameter to html/xml


bibber
06-28-2006, 06:54 AM
Hello,

I want to link to a photo fromt he command prompt, and the corresponding url opens in internet explorer, but the browser opens without toolbar, menu etc. Both toolbar=no (etc..) and the number of the photo are a parameters.

Prerably the browser reads the parameters and knows how to open the browser and which photonumber, else with a local stored file (not on a webserver), which re-directs with: open.window('')...

e.g.: iplorer.exe "c:\temp\page.html?toolbar=no&photo=49596"

I hope its clear...

Jon Hanlon
06-28-2006, 08:18 PM
iexplore.exe -k "c:\temp\page.html?photo=49596"
(use alt-F4 to close the page.)

page.html

<body onload='loadPic()'>
<img name='pic' id='pic'>

<script>
function loadPic() {
var page = getArgument("page");
if (!page) return;
document.getElementById("pic").src = "C:\\photos\\" + page + ".jpg"
}

function getArgument(sArg) {
var allArgs = window.location.search.substring(1).split('&');
for (var j=0; j<allArgs.length; j++) {
var thisArg = allArgs[j].split("=");
if (thisArg[0] == sArg) return thisArg[1];
}
return false;
}
</script>

bibber
06-29-2006, 09:50 AM
Thanks for your reply. I get the idea of your script, but when a insert the URL in IE, it immediately gives me an error: cannot find page (without the variable it does). So it has problems with ?photo=49596. Any ideas?

Secondly, are there more parameters beside -k to open IE?

Jon Hanlon
06-29-2006, 07:13 PM
1) IE often gets confused with the backslashes. Experiment on a simple URL before getting fancy. You may need to use forward slashes instead, or a number of slashes.
I forget which.

2) http://support.microsoft.com/kb/q178058