Title: Java script errors
Last modified: June 13, 2018

---

# Java script errors

 *  [osilvab](https://wordpress.org/support/users/osilvab/)
 * (@osilvab)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/java-script-errors/)
 * I have the widget in the side bar. When using full width pages or having the 
   visibility filtered. the widget gives JS errors:
 *     ```
       Uncaught TypeError: Cannot read property 'url' of undefined
           at HTMLDocument.<anonymous> (wp-liveracers.js?ver=1:26)
           at i (jquery.js?ver=1.12.4:2)
           at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
           at Function.ready (jquery.js?ver=1.12.4:2)
           at HTMLDocument.K (jquery.js?ver=1.12.4:2)
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fjava-script-errors%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [pglewis](https://wordpress.org/support/users/pglewis/)
 * (@pglewis)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/java-script-errors/#post-10928098)
 * I apologize for long delay, my excuse is that I don’t seem to get email notifications
   on new support posts. This plugin isn’t super active, being a niche, there’s 
   not a lot to break, and it has been stable for ages so I haven’t been checking
   in here very often.
 * Excuses aside I will still support the plugin. Let me know if you still have 
   issues and haven’t found a workaround and I’ll play around based on the info 
   in your post and see if I can reproduce the problem.
 *  Thread Starter [osilvab](https://wordpress.org/support/users/osilvab/)
 * (@osilvab)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/java-script-errors/#post-10929350)
 * Thanks for the reply 🙂
 * I think i never managed to “fix” it. what i did was not use the plug-in directly
   but use a Custom HTML widget with the instructions at:
 * [http://liveracers.com/Support/Widgets/Widget/Live](http://liveracers.com/Support/Widgets/Widget/Live)
 * using the code:
 * `<div id="lr-servers" orientation="horizontal" width="300px" canjoin="true"></
   div>`
 * and it was working for sometime. later I got a SSL certificate for the website
   and so the script stopped working whenusing https, I changed the URL in the <
   head> in to https:
 *     ```
       <script type="text/javascript">
           window._lr = {
               url: 'httpS://liveracers.com',
               domains: ['domain'] //or multiple domains: ['domain1', 'domain2']
           };
           (function () {
           	var lr = document.createElement('script'); lr.type = 'text/javascript'; lr.async = true;
           	lr.src = window._lr.url + '/Scripts/api.js';
           	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lr, s);
           })();	
       </script>
       ```
   
 * But it didnt work anymore.
 * so right now it doesnt show any server unless i forced the use of non-secure 
   http.
    -  This reply was modified 7 years, 8 months ago by [osilvab](https://wordpress.org/support/users/osilvab/).
 *  Plugin Author [pglewis](https://wordpress.org/support/users/pglewis/)
 * (@pglewis)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/java-script-errors/#post-10931583)
 * Let’s trace this back from the main error message: “Cannot read property ‘url’
   of undefined”. That would be coming from here:
 * [https://github.com/pglewis/wp-liveracers/blob/15485d0/scripts/wp-liveracers.js#L26](https://github.com/pglewis/wp-liveracers/blob/15485d0/scripts/wp-liveracers.js#L26)
 * There should be a global Javascript _lr object and _lr.url should hold the league’s
   LiveRacer URL. The _lr object should be created in a script tag directly above
   the div that holds the widget itself:
 * [https://github.com/pglewis/wp-liveracers/blob/15485d0/wp-liveracers.php#L107](https://github.com/pglewis/wp-liveracers/blob/15485d0/wp-liveracers.php#L107)
 * The error basically says the _lr object doesn’t exist, however. My first guess
   was maybe the widget area was inside an iFrame in your theme or something like
   that but I don’t see any such thing checking your page.
 * The first thing I’d do is manually double-check that _lr is missing from the 
   console in Dev Tools (Chrome), Firebug (Firefox), or whatever your browser uses
   to get to the Javascript console. Just type _lr (note the leading underscore)
   and hit enter and see if it is undefined. If so, you’ll want to check the page
   source where the widget is inserted and see if the script that defines _lr exists.
    -  This reply was modified 7 years, 8 months ago by [pglewis](https://wordpress.org/support/users/pglewis/).
 *  Thread Starter [osilvab](https://wordpress.org/support/users/osilvab/)
 * (@osilvab)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/java-script-errors/#post-10940858)
 * The thing is that I’m not using the plugin anymore. so right now the problem 
   can not be reproduced.
 * But if it helps, the plugin was being used on the siderbar that was visible only
   on homepage. But in other pages where sidebar was hidden then it was showing 
   those errors and the format of the page (full width) was misplaced.
 * Now i’m using the manual approach with the codes found in the liveracers page.
   I have the script on the <head> of the webpage and a custom html widget instead
   of the wp-liveracers plugin. It works well, but not in https.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Java script errors’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-liveracers.svg)
 * [WordPress LiveRacers](https://wordpress.org/plugins/wp-liveracers/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-liveracers/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-liveracers/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-liveracers/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-liveracers/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [osilvab](https://wordpress.org/support/users/osilvab/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/java-script-errors/#post-10940858)
 * Status: not resolved