Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q650 How can I load someone elses page and then submit a form that tells me how long it took to load?

You are here: irt.org | FAQ | JavaScript | Form | 11 | Q650 [ previous next ]

You can pass the url from one page to another:

<FORM TARGET="myWindow" ACTION="myPage.htm">
URL: <INPUT NAME="URL" TYPE="INPUT">
<INPUT TYPE="SUBMIT">
</FORM>

and then in mypage.htm:

<SCRIPT LANGUAGE="JavaScript"><!--
function loaded() {
    end = new Date();
    formFrame.myForm.TIME.value = (end.getTime() - start.getTime())/1000; // seconds
    formFrame.myForm.URL.value = URL;
    formFrame.myForm.submit();
}

URL = location.search.substring(5);
start = new Date();

document.write('<FRAMESET onLoad="loaded()">');
document.write('<FRAME SRC="' + URL + '">');
document.write('<FRAME SRC="myForm.htm" NAME="formFrame">');
document.write('</FRAMESET>');
//--></SCRIPT>

And in myForm.htm:

<FORM NAME="myForm">
<INPUT TYPE="HIDDEN" NAME="URL">
<INPUT TYPE="HIDDEN" NAME="TIME">
</FORM>

©2018 Martin Webb