apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.27k stars 382 forks source link

Uncaught TypeError: Cannot read property 'firstChild' of null #534

Closed arku closed 7 years ago

arku commented 7 years ago

I followed the steps provided in the documentation but I am unable to get it working. I am getting the following error message

Uncaught TypeError: Cannot read property 'firstChild' of null

in the https://maps.google.com/maps/api/js script. From the error message, what I understand is that the script is trying to call the method firstChild method on a Node object but it's null.

I am not sure how to solve this. Any help would be appreciated.

arku commented 7 years ago

My bad. I was trying to load the script before the DOM was loaded. I moved the script to the end of body and it worked fine.

I'll close the issue as it was a mistake from my side.

Robiullah2244 commented 5 years ago

I was trying to load the DOM before the script was loaded. But I didn't come to the solution. Sometimes Script is loaded before dom although Script was written at the end. For that, you can load Script with defer.

difer

educhip commented 5 years ago

My bad. I was trying to load the script before the DOM was loaded. I moved the script to the end of body and it worked fine.

I have been 2 days trying delete cache for several methods! but the solution was this! Thanks mate ;-)