Alexandre Alexandre - 10 months ago 40
Javascript Question

How can I go to a new page from within javascript?

I have a link like this:

<a href="">

I would like to simulate the clicking of this link within javascript with a function that is called with the left arrow but I am not sure how to do it.

Now I have this:

$(window).keypress(function (e)
if (e.keyCode == 37)
// position 1


But I am not sure how to change the page to the link "" from within javascript at position 1. Can someone help me with this.


You could use the following to perform a redirect:

window.location.href = '';