0

Navigate to the following page:

https://www.business.hsbc.co.uk/1/2/bib/username

In their infinite wisdom HSBC have decided to pester their customers with this anti-virus program (Rapport) ad every time the online banking login screen is accessed. Any reason not to download the software is never persisted, making this repetitive process infuriating for millions of UK HSBC customers.

I was wondering if it is possible to write a bookmarklet to load the page and hide the div using a timeout?

I've tried the following but it doesn't seem to execute the script in the setTimeout block.

javascript:if(window.location!="https://www.business.hsbc.co.uk/1/2/bib/username"){window.location="https://www.business.hsbc.co.uk/1/2/bib/username"};
javascript:(window.setTimeout(function() { document.getElementById("rap_wrapper").style.display = "none"; }, 1000));void(0);

rap_wrapper is the only element that needs to be removed in the DOM. The setTimeout is there to give sufficient time for the page to load. But I think this approach is sub-optimum as fire too early on slow connections. Is there anyway I can use Chrome debugging tools to find the exact function that opens the modal box and kill it there?

Perhaps this is going a little beyond the scope of a simple bookmarklet, so would be happy to write a Chrome Extension instead. Just really trying to understand the best approach at this stage.

EDIT 1:

Bookmarklet is not going to work for this job as the location.href change will terminate any code that follows (see post here for more info). So I'm guessing a Chrome Extension it is, certainly will be easier, was just looking for a quick and dirty hack.

Community
  • 1
  • 1
QFDev
  • 8,668
  • 14
  • 58
  • 85
  • If the problem is really as simple as hiding the element, just use CSS: `#rap_wrapper {display:none !important;}` – Rob W May 31 '14 at 12:52
  • Is it possible to manipulate css rules in a bookmarklet? I think onload it is actually in `display:none` state, some JS is revealing it immediately after. – QFDev May 31 '14 at 12:59
  • Yes, just create a ` – Rob W May 31 '14 at 13:00
  • 1
    Unfortunately my Bookmarklet approach is not going to work due to the initial `location.href` change (see EDIT 1). Chrome Extension will allow me to do what you suggest, thanks for the help! – QFDev May 31 '14 at 13:05
  • As long as the result is void, i.e. `undefined`, then the page will not unload. Though an extension is easier to use. – Rob W May 31 '14 at 14:17

0 Answers0