Is there a way to get the coordinates(x,y) of the URL on a website in the browser window?
I already tried to view the inspect element but was not able to find what I am looking for.
Is there a way to get the coordinates(x,y) of the URL on a website in the browser window?
I already tried to view the inspect element but was not able to find what I am looking for.
I think I understand what you're asking for. In this case I have identified the link when it is clicked and by ID. The former will execute the link behavior, but both methods do what you want. Note that this only gives you the location within the browser's content and not the absolute location on the screen.
<p>I put some text here for the experience of having <a id="link" href="somewhere.com" onclick="findMe(this)">this link</a> in a paragraph which will put it on the page and I can adjust the size of the browser window to show that it moves around and changes the location.</p>
<p><button onclick="findTag()">Click</button>
<script>
function findMe(tag)
{
alert(tag.offsetLeft+", "+tag.offsetTop);
}
function findTag()
{
//so this would identify the <a> without following the href
findMe(document.getElementById("link"));
}
</script>