-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Cannot read property 'location' of null" error in javascript #244
Comments
I am getting the same error in the chrome console: I've narrowed it down to intercom and turbolinks (latest version 5.0.1) not working together, specifically when the browser's back or forward button is used and turbolinks is rendering from cache. Update: I was able to eliminate the error by manually inserting Maybe this isn't necessarily a bug but should be documented in the readme for turbolinks users? |
@savmac I tried your workaround and I'm still receiving the location null error. Did placement compared to other javascript (if any) in the head matter? |
+1 I'm having the same issue. |
@buffym Is your project using Turbolinks? In my case it appeared as a conflict with Turbolinks since it only renders the body and not the head after the initial page load. All of my scripts were in the head except for Intercom's because of it's automatic insertion into the body which I didn't realize until I saw this error. If you are not using turbolinks then it may be a different issue causing the error. I'm not that great with javascript so I'm not really sure how to investigate it further. It could be similar to this pull request except fix it for the latest version of turbolinks. Maybe someone from the Intercom team can check it out? |
@savmac I am using Turbolinks. I load most of my page javascript before the closing body tag, and use "data-turbolinks-eval=false" to prevent Turbolinks from reloading it when it swaps things around. But, I moved the intercom js to the head as you suggested in here, but am still seeing the location null error in the frame js. |
I'm not using turbolinks an the error is still there |
In case it helps the investigation, I just checked my history and initially I was using the latest version of turbolinks and definitely did not have this error. Weeks later I updated the intercom-rails gem from 0.2.30 to 0.3.4 and subsequently discovered this error. |
Thanks @savmac I'll look into rolling back my intercom-rails version (for now) and see if that helps. |
I'm still having this error. How can this be solved? |
Is there any chance this will get fixed? I'm getting dozens of errors everyday from this library. |
Bump on this. Can we please get this resolved? We're using Rails 5, Turbolinks 5, with Tons of these errors every day. |
This should be fixed now. Can you confirm you don't see any |
This error has disapeard, but right now, I'm experiencing tons of |
I see you created another issue for this new problem. I'll close this issue as it is fixed. |
@Skaelv - We are persistently seeing this error on production, and have been for close to a year. It seems to come and go - most recently it's affecting Chrome users on both Android and Windows. We are running. |
Same issue here. I can confirm that disabling Turbolinks fixes the issue, but not sure if the problem is in Turbolinks or in https://js.intercomcdn.com/frame.1c4eb843.js |
Hi! As the Turbolinks change pages we need update intercom before. I could manage a workaround just playing "update" method right after boot it.
Hope it helps someone. |
Hi. I've recently integrated javascript error reporting and started to see some exceptions from the intercom javascript script. The error comes from https://js.intercomcdn.com/frame.2f08db79.js , line 24 column 701. It's the definition of the function _getCurrentPage
r.prototype._getCurrentPage=function(){return window.location.href}
I'm not sure if this is normal, looks like in the context of the execution of this function window is undefined.
This is the complete stack trace:
Thanks!
Version info
The text was updated successfully, but these errors were encountered: