Make google chrome bookmark to a button on a page

1

There is a webpage that I frequently use at work, where I go to the page and then click on a button on the page. What I would like is to have a bookmark which takes me directly to the destination of the button.

If I inspect element on the button, I get this:

<a href="#" id="new" onclick="Rally.nav.Manager.create('defect', {iteration: 'u'});return false;">New Defect.../a>"

Is there a way I can bookmark this page and then have my browser automatically perform that onclick action as a command, thus taking me directly to the button destination?

Datguy

Posted 2015-10-29T16:11:57.800

Reputation: 19

Answers

1

If the page navigates when you click the link we may be able to help more if you give us a link to the page. Besides that...

I don't think you can access the page post-load from a script that you run pre-navigation because it would violate the same origin policy. The easiest way would probably be to install the Tampermonkey plugin for chrome. To start, create a new user script and add the page with the button as an "Included Page".

The script could be pretty simple since the button has an ID.

document.getElementById('new').click();

If the page uses jQuery you can simplify it to

$("#new").click();

Depending on how the content is created the button may not exist on page load in which case you could use a timeout or jQueries .ready method on the document to give the page time to finish loading.

window.setTimeout(function () {
    document.getElementById('new').click();
}, 1000); //milliseconds to wait, can be adjusted

or

$(document).ready(function () {
    $("#new").click();
});

Marie

Posted 2015-10-29T16:11:57.800

Reputation: 170