So I noticed I answered a question you didn't ask...I should keep that in mind next time somebody does the same to me.
Anyhow, try this, which is also entirely client side. I've attached a copy since this forum software eliminates my extra line breaks.
Note that I've tested this against ESRI's Measure widget, and concluded the Measure widget doesn't work properly. I've hand calculated the distance between two points after acquiring their coordinates from the map, and it's quite a bit different from what the Measure tool measures between those points. I tested with data in Web Mercator...not sure if that would make a difference.
As such, I think this works properly. It assumes a few things, like a valid polyline with at least one path that has at least 2 points. It returns null if the distance is greater than the path's length, or if the distance is negative.
function distanceBetweenPoints(x1, y1, x2, y2) {
return Math.sqrt(Math.pow(x2 - x1, 2) + (Math.pow(y2 - y1, 2)));
}
function getPointAlongLine(polyline, distance, pathIndex) {
if (!pathIndex)
pathIndex = 0;
if (!distance)
distance = 0;
if ((pathIndex >= 0) && (pathIndex < polyline.paths.length)) {
var path = polyline.paths[pathIndex];
var x1, x2, x3, y1, y2, y3;
var travelledDistance = 0;
var pathDistance;
var distanceDiff;
var angle;
if (distance === 0)
return polyline.getPoint(pathIndex, 0);
else if (distance > 0) {
for (var i = 1; i < path.length; i++) {
x1 = path[i-1][0];
y1 = path[i-1][1];
x2 = path[0];
y2 = path[1];
pathDistance = this._distanceBetweenPoints(x1, y1, x2, y2);
travelledDistance += pathDistance;
if (travelledDistance === distance)
return polyline.getPoint(pathIndex, i);
else if (travelledDistance > distance) {
distanceDiff = pathDistance - (travelledDistance - distance);
angle = Math.atan2(y2-y1, x2-x1);
x3 = distanceDiff * Math.cos(angle);
y3 = distanceDiff * Math.sin(angle);
return new Point(x1 + x3, y1 + y3, polyline.spatialReference);
}
}
}
}
return null;
}