Support Overview

Tutorials

Usage Examples

Upgrade Information

FAQ

New Release History

You are here:   Visualware >   MyConnection Server >   Support >   Tutorials >   Creating a eMail Results link after the test has finished

Creating a eMail Results link after the test has finished

Step 1

The <param> that needs to be added to your applet code is:

<param name="js" value="">

Where the value is the JavaScript function and parameters passed. So the applet code may look similar to the code on the right.

Step 2 explains how to fill in the "value=" part of the param.

<applet MAYSCRIPT name="myspeed" code="myspeedserver/applet/myspeed.class" archive="/myspeed/myspeed_s_8.jar,/myspeed/plugins_s_8.jar" width="600" height="400">
<param name="js" value="">
<param name="testspecid" value="-2"></param>
<param name="permissions" value="all-permissions"></param>
Java is required to view this applet
</applet>

Step 2

For this tutorial we are going to pass a few variables that would relate to a MySpeed test.

A full list of all variables for all plug-ins can be found in the JS reporting section of the manual applet configuration within MyConnection Server.

The code on the right will run a JavaScript function called "mys" and pass the parameters specified. In this case they are download speed, upload speed, quality of service, round-trip time and maximum delay.

<param name="js" value="mys($SPEED.DSPEED$,$SPEED.USPEED$,$SPEED.QOS$,
$SPEED.RTT$,$SPEED.MAXPAUSE$)">

Step 3

The JavaScript function now needs to be written to deal with the parameters passed and then provide a link to launch a new email with the results included.

The example JavaScript on the right will do just that. The location of where the link appears is governed by the position of a <div> within the HTML of your page.

A full, copy and paste example will be given at the end of this tutorial. In this example the correct div format should look like what's shown on the right.

<div id="elink"></div>

The JavaScript needed is:

<script>
var _ebody;
function addCommas(n) {
var s=""+n;
var len = s.length;
for (var at=len-3; (at>0); at-=3) {
s = s.substring(0,at)+","+s.substring(at);
}
return s;
}

function mys(dspeed,uspeed,qos,rtt,maxp) {
_ebody = "";
_ebody += "Visualware MySpeed Test Results\n\n";
_ebody += "The MySpeed test results below show Speed and Quality measurements\n";
_ebody += "\n";
_ebody += "URL: " + location.href+"\n";
_ebody += "When: " + new Date()+"\n";

_ebody += "Download: " + addCommas(dspeed)+" bps\n";
_ebody += "Upload: " + addCommas(uspeed)+" bps\n";
_ebody += "QOS: " + qos+"%\n";
_ebody += "RTT: " + rtt+" ms\n";
_ebody += "MaxPause: " + maxp+" ms\n";
var s = '<a href="javascript:emailnow()"><b>Click to email these results</b></a><br><br>';
document.getElementById('elink').innerHTML = s;
}
function emailnow() {
document.location.href = "mailto:myspeed@company.com?subject=MySpeed Test Results&body="+escape(_ebody);
}

</script>

Step 4

Copying and pasting everything on the right into the HTML of your page (paste it where you would like the applet to appear) will get you 99% of the way there.

The only thing that needs changing is in bold below.

The codebase in this example is set to our server, simply change this entry to your own MyConnection Server address.

<!-- The Javascript below creates the email body from the results of the speed test -->
<script>

var _ebody;
function addCommas(n) {
var s=""+n;
var len = s.length;
for (var at=len-3; (at>0); at-=3) {
s = s.substring(0,at)+","+s.substring(at);
}
return s;
}
function mys(dspeed,uspeed,qos,rtt,maxp) {
_ebody = "";
_ebody += "Visualware MySpeed Test Results\n\n";
_ebody += "The MySpeed test results below show Speed and Quality measurements\n";
_ebody += "\n";
_ebody += "URL: " + location.href+"\n";
_ebody += "When: " + new Date()+"\n";

_ebody += "Download: " + addCommas(dspeed)+" bps\n";
_ebody += "Upload: " + addCommas(uspeed)+" bps\n";
_ebody += "QOS: " + qos+"%\n";
_ebody += "RTT: " + rtt+" ms\n";
_ebody += "MaxPause: " + maxp+" ms\n";
var s = '<a href="javascript:emailnow()"><b>Click to email these results</b></a><br><br>';
document.getElementById('elink').innerHTML = s;
}

function emailnow() {
document.location.href = "mailto:myspeed@company.com?subject=MySpeed Test Results&body="+escape(_ebody);
}

</script>

<!-- The applet code below displays the MySpeed applet -->

<applet mayscript name="mcs" code="myspeedserver/applet/myspeed.class" archive="/myspeed/myspeed_s_8.jar,/myspeed/plugins_s_8.jar" codebase="http://mcslhr.visualware.com/myspeed" width=600 height=400>
<param name="permissions" value="all-permissions"></param>

<param name="testspecid" value="-2">
<param name="js" value="mys($SPEED.DSPEED$,$SPEED.USPEED$,$SPEED.QOS$,$SPEED.RTT$,$SPEED.MAXPAUSE$)">
</applet>

<!-- The DIV below is where the email link will appear once the test has finished -->

<br><br>
<div id="elink"></div>

Step 5

On the right is a working example of how the steps above should work.



 

MyConnection Server

Home
Online Testing Portal
Download
Purchase
Resources
Support

Visualware Products

VisualRoute
eMailTrackerPro
Visual IP Trace

   

© Visualware Inc. 2014 - All Rights Reserved