elementFromPoint in a windows phone 8 webbrowser

Tuesday, July 8, 2014

in a Windows phone 8 webbrowser i would detect a image when user tap on html element. for calculate coordinates i use this code but not it works on device (works in emulator)



//point of tap
Point point = e.GetPosition(obj);

string js = @"function GetImageUrl()
{
var x = " + point.X + ";" +
var y = " + point.X + ";" +
var xMod = screen.logicalXDPI / screen.deviceXDPI;
var yMod = screen.logicalYDPI / screen.deviceYDPI;
var xPos = document.body.scrollLeft + Math.round(xMod * x);
var yPos = document.body.scrollTop + Math.round(yMod * y);
var element = document.elementFromPoint(xPos,yPos);
if (element.tagName.toUpperCase() == 'IMG')
{
var httplink = element.src;
return httplink;
}

};
GetImageUrl();";


calculation of xPos and yPos is correct? thanks







http://ift.tt/1mvKlnR