Use this technique when you want the Viewer API calls to be made as a result of an action in the calling page, but you do not want to reload the page. For example, you may have a page that generates a list of locations and you would like the user to be able to jump directly to any location, while leaving the list still available in the task pane.
target="scriptFrame" as part of the <a> tag. This requires creating a separate page to load in the script frame and passing the necessary parameters when the page loads.
In this case, your page can load another page in the hidden script frame, usinggotopoint.php that is designed to run in the script frame. The <body> element is empty, so the page does not produce any output. Instead, it emits a JavaScript function to execute when the page loads. This function calls the ZoomToView() function in the Viewer API. The essential parts of gotopoint.php are:
The Hello Viewer sample application contains a file named<script language="javascript">
function OnPageLoad()
{
parent.ZoomToView(<?= $_GET['X'] ?>,
<?= $_GET['Y'] ?>,
<?= $_GET['Scale'] ?>, true);
}
</script>
<body onLoad="OnPageLoad()">
</body>
gotopoint.php from the task frame, insert code similar to the following:
To execute$xLocation = -87.7116768; // Or
calculate values
$yLocation = 43.7766789973;
$mapScale = 2000;
echo "<p><a href=\"gotopoint.php?" .
"X=$xLocation&Y=$yLocation&Scale=$mapScale\"" .
"target=\"scriptFrame\">Click to position map</a></p>";