MTS3Interface 5.0.2.x Quick Reference
Several changes have been made to MTS3Interface.js to simplify developer support of VMP installation. As a Developer, the new API functions are used to control how end-users will engage VMP content. This document covers the API and best practices for implementation.
Basic API Use Cases
 |
Frame
Opens a frame at the top of the window with the page's original content sitting in the bottom frame. Viewpoint branded frame tells user they'll need VMP to view the page's content, and offers links to the EULA, viewpoint.com, and privacy policy.
|
 |
 |
Popup by User Event
To circumvent popup blockers, this method of installation can be triggered with onclick event handlers (or other user-event handlers.) Opens a popup window with Viewpoint branded installer page. Tells user they need VMP to view the page content, and offers links to the EULA, viewpoint.com, and privacy policy.
|
 |
 |
Executable Link
Returns a javascript file path that can be placed in any onlick or anchor tag in the page to link directly to the executable installer. This method requires more thought by the developer for a good user experience. A common use would be displaying an alternate content image or button, which is clickable.
|
|
 |
Frame (Default / Automatic)
If the developer does not use one of the above installation functions prior to the VMP constructor line, the default behavior is to use the frame based installer. No additional code is needed.
|
API Methods
| Method |
Returns |
Description |
| VMPInstallWithPopup() |
none |
Displays a popup with NE Installer. We recommend this function be triggered by a user event, such as onClick, to prevent usability issues and to prevent popup blockers from catching it. |
| VMPInstallWithFrame() |
none |
Displays a frame at the top of the content page with NE Installer. Also default method of installation. |
| VMPInstallURL() |
String |
Returns a javascript hyperlink to download an executable installer appropriate to the user's browser and OS combination. If the user's configuration is not supported, "undefined" is returned. This method should only be used after an evaluation of VMPSupported(). |
| VMPInstalled() |
Boolean |
Returns true if VMP is installed correctly, and false if it is not. IsMTSInstalled() is a deprecated version of this function. |
| VMPSupported() |
Boolean |
Returns true if the browser and OS combination are supported by VMP, otherwise returns false. |
API Sample Implementations
The basic VMP constructor line, when executed, will prompt the user to install VMP with the frame-based NE Installer if the user does not have VMP. If the developer desires a different user experience, they may achieve this with the API functions provided above. The following code samples show how to implement the API in common use cases.
>> Default behavior of MTSPlugin constructor:
1.1) If VMP is installed, show content.
1.2) If not, prompt user for installation with frame based installer automatically.
<script type="text/javascript">
var vmp = new MTSPlugin("myScene.mtx", "400", "300", "", "simple", "");
</script>
If your VMP content is within a Frame or iFrame, use the topurl parameter with the URL of the containing page or frameset to be shown during (and after) installation:
<script type="text/javascript">
var vmp = new MTSPlugin("myScene.mtx", "400", "300", "", "simple",
¶ "topurl=http://www.yoursite.com/");
</script>
>> API Example #1, Click based installation:
1.1) If VMP is installed, show content.
1.2) If not, write a link to the page that, when clicked, will prompt user for installation.
<script type="text/javascript">
if (VMPInstalled()) {
var vmp = new MTSPlugin("myScene.mtx", "400", "300", "", "simple", "");
} else {
// Use one of these, not both ...
document.write('<a href="javascript:VMPInstallWithPopup()">Click to install VMP</a>');
document.write('<a href="' + VMPInstallURL() + '">Click to install VMP</a>');
}
</script>
>> API Example #2, Automatic Frame Installation with Alternate Content:
1.1) If VMP is installed, show content.
1.2) If not, determine if user configuration is supported.
2.1) If YES, prompt user for installation with automatic frame.
2.2) If NO, show alternate content.
<script type="text/javascript">
if (VMPInstalled()) {
var vmp = new MTSPlugin("myScene.mtx", "400", "300", "", "simple", "");
} else if (VMPSupported()) {
VMPInstallWithFrame();
} else {
document.write('<img src="alternate.png" alt="">');
}
</script>
>> API Example #3, Direct link to the VMP executable:
1.1) If VMP is installed, show content.
1.2) If not, determine if user configuration is supported.
2.1) If YES, write a link to the page that, when clicked, will download VMP without the web based installer.
2.2) If NO, show alternate content.
<script type="text/javascript">
if (VMPInstalled()) {
var vmp = new MTSPlugin("myScene.mtx", "400", "300", "", "simple", "");
} else if (VMPSupported()) {
document.write('<a href="' + VMPInstallURL() + '">Click here to download VMP!<\/a>');
} else {
document.write('<img src="alternate.png" alt="">');
}
</script>