The code below is supposed to get the new url as root while the page loads. I tried targeting the class as .click and that didn’t work as well. Any help would be appreciated.
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script>
$(document).ready(function() {
$("a").trigger('click');
});
</script>
<a href="/" class="click"> </a>
You can use
trigger('click')to trigger the JavaScript code for a click event. However, for security reasons, you cannot use it to simulate a mouse click that would actually open a link. You must do that by assigning towindow.locationdirectly:Also, please read this.