Hacker News new | ask | show | jobs
by martian 5193 days ago
The "google" variable is often not loaded for people who use Adblock or similar extensions that block social media plugins. You can simply check that "google" exists before running the code that depends on it:

    if (typeof google !== "undefined") {
        // run google code here
        google.magic();
    }