Tuesday, April 30, 2019

1Password and Freshbooks Not on Speaking Terms | Tamper Monkey to the Rescue

Months ago Freshbooks and 1Password decided to stop working together. I use Freshbooks to track my time for my business and I use 1Password for easy login to sites in general. For some reason, 1Password's auto-fill function stopped functioning on the Freshbooks login page.

I reached out to 1Password was pleased with their response: they acknowledged the issue and they even went into technical detail as to what was causing the problem (a stray iframe on the page to was to blame). I figured I'd let the developers over at 1Password solve this issue. However, after a few more weeks of manually copying and pasting my password I decided it was time to take matters into my own hands.

I had a vague notion that Firefox's Grease Monkey addon was designed to hack pages on your behalf. However, I'd never used it. And these days, I'm using Chrome as my primary browser. A bit of Googling confirmed that my thinking was in the right direction: Chrome offers a plugin named Tamper Monkey and it does the on the fly page hacking I believed I needed.

I installed Tamper Monkey, and worked up the following script:

// ==UserScript==
// @name         Freshbooks + 1password fixer
// @namespace    http://code.benjisimon.com
// @version      0.1
// @description  Freshbooks and 1password aren't working together, so I'm writing some code to make them work together.
// @author       Ben Simon
// @match        https://my.freshbooks.com/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var trouble = document.getElementById("zendesk-widget-iframe");
    if(trouble) {
        trouble.parentNode.removeChild(trouble);
    }
})();

The script worked like a charm! With the errant iframe removed, 1Password was back to working. And best of all, I've added Tamper Monkey as a new tool to my toolbox.

No comments:

Post a Comment