Saturday, August 2, 2014

Chrome Browser: hack yourself!

The fact that Google Chrome is mostly configured and handled in HTML and JavaScript pages itself make it a cool advantage if you want to play around. To be clear, yes, the Settings page is HTML, the History page, etc...

Since a while ago I was disappointed by the poor handling tool for history in Chrome. Now I learned the lesson, you have to inject JS code and get hacked, by yourself obviously jaja.

Interestingly, the History page is loaded into an iframe. If you want to have the iframe content at the current document you have to visit chrome://history-frame/
There, you can execute search queries using the textbox. In the past, If you wanted to select all the elements, that was not possible! What I'm sharing now it's just a simple JS code which selects all the checkboxes.

var inputs = document.getElementsByTagName('input');
for (var i = 0; i < inputs.length; ++i) {
    if (inputs[i].type == "checkbox") {
        inputs[i].checked = true;
    }
}
Don't forget to enable the Delete button :)
document.getElementById("remove-selected").disabled = false

This is just a simply example. You can actually add a more complex logic about selecting or not a checkbox. And actually, you can inject JS code anywhere in Google Chrome, that'd do the trick.

I originally shared it in Stack Overflow to solve a concrete problem:
http://superuser.com/questions/480646/how-can-i-delete-all-web-history-that-matches-a-specific-query-in-google-chrome/791728#791728

No comments:

Post a Comment