title: Handling ReferenceError: geoip2 is not defined in jQuery or JavaScript
body: <p>I am using the geoip2 API to detect countries in my script.</p>
  
  <p>I have written a script for success and error, however the error part never fires.</p>
  
  <pre><code>geoip2.country(onSuccess, onError);
  </code></pre>
  
  <p>I checked and saw that uBlock origin on my Firefox is blocking the geoip2 script. The error in my browser console is </p>
  
  <pre><code>ReferenceError: geoip2 is not defined
  </code></pre>
  
  <p>How do I handle this in jQuery and display a user to the message if I get the above error?</p>
  
  <p>I am calling these scripts from index.html in the following way </p>
  
  <pre><code>&lt;script type="text/javascript" src="//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js"&gt;&lt;/script&gt; 
  &lt;script src="/scripts/js/jqgp.js"&gt;&lt;/script&gt; 
  </code></pre>
  
  <p>In jqgp.js I also tried this, </p>
  
  <pre><code>if (geoip2 == undefined) {
      console.log("Please disable adblock.");
  }
  </code></pre>
  
  <p>or </p>
  
  <pre><code>if(!geoip2)
  {
  console.log("Please disable adblock.");
  }
  </code></pre>
  
  <p>But it didn't execute. I am using Firefox. By the way, everything works OK if uBlock is switched off.</p>