How To Automatically Click A Link When The Website Loads
I am trying to figure out how to make an anchor link clicked when the website is visited. I would be grateful if someone can help me, here's a demo code, you can match the id for m
Solution 1:
Use the meta tag to redirect to another page when the page loads:
<meta http-equiv="refresh" content="2;url=http://www.example.com/" />
Where 2
is the number of seconds before the redirect occurs.
This will be more reliable and more straightforward than writing JavaScript to click a link. Let me know how it works for you.
Solution 2:
The jquery answer:
$($('#deepakkamat').click());
This will actually register a click event as the cause, but it seems awfully unnecessary. The meta method is the preferred method.
Solution 3:
When you're trying to archive a redirect, use document.location.href = "http://mywebpage.com"
(or the meta tag mentioned before).
There is also a click
method available, so that you can run
document.getElementById("deepakkamat").click();
Post a Comment for "How To Automatically Click A Link When The Website Loads"