Jump to content
Keith Vaugh

Maps section not displaying

Recommended Posts

Keith Vaugh

Hi all

I am doing some optimisation on my website and minimising the javascript. When I do this, the map on https://www.magva.com/contact/ fails to load. 

I can exclude the js if I know what it is, but cannot determine it. All I am getting from the javascript console is: 

Uncaught Ebmessage: "pl_initialize_maps is not a function"name: "InvalidValueError"stack: "Error↵    at new Eb (https://maps.googleapis.com/maps/api/js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:41:365)↵    at Object._.Fb (https://maps.googleapis.com/maps/api/js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:41:475)↵    at Og (https://maps.googleapis.com/maps/api/js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:96:420)↵    at https://maps.googleapis.com/maps/api/js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:131:58↵    at Object.google.maps.Load (https://maps.googleapis.com/maps/api/js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:21:5)↵    at https://maps.googleapis.com/maps/api/js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:130:20↵    at https://maps.googleapis.com/maps/api/js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:131:73"__proto__: Error
Og @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:96
(anonymous) @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:131
google.maps.Load @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:21
(anonymous) @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:130
(anonymous) @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:131

If i exclude maps.js the map reappears but I get the following error:

Uncaught ReferenceError: pl_do_shortcode is not defined
    at pl_run_map (maps.js:190)
    at HTMLElement.<anonymous> (maps.js:114)
    at HTMLElement.dispatch (jquery.js:3)
    at HTMLElement.r.handle (jquery.js:3)
    at Object.trigger (jquery.js:3)
    at HTMLElement.<anonymous> (jquery.js:3)
    at Function.each (jquery.js:2)
    at n.fn.init.each (jquery.js:2)
    at n.fn.init.trigger (jquery.js:3)
    at window.pl_initialize_maps (maps.js:118)
pl_run_map @ maps.js:190
(anonymous) @ maps.js:114
dispatch @ jquery.js:3
r.handle @ jquery.js:3
trigger @ jquery.js:3
(anonymous) @ jquery.js:3
each @ jquery.js:2
each @ jquery.js:2
trigger @ jquery.js:3
window.pl_initialize_maps @ maps.js:118
(anonymous) @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:96
(anonymous) @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:49
_.ac @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:46
lc @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:49
(anonymous) @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:131
google.maps.Load @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:21
(anonymous) @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:130
(anonymous) @ js?key=AIzaSyA0CUH1aTKlyXep9smmmWiyEOu052QnMpE&callback=pl_initialize_maps:131
 

@Simon do you have any suggestions or possible solutions?

Thanks

 

 

Share this post


Link to post
Share on other sites
Simon

In your attempt to to get the meaningless 100% score you have minified and concatenated all the js into one file in the footer. Your optimize plugin does not care for script load order thats why google maps expects maps.js to be right before it is called, but you have forced it into the footer, hence your error.

In your attempt to to get the meaningless 100% score you have minified and concatenated all the js into one file in the footer. Your optimize plugin does not care for script load order thats why google maps expects maps.js to be right before it is called, but you have forced it into the footer, hence your error.

Also the time to first byte on your site before W3 total crash had loaded was about 10s what sort of host are you using to be that slow?

Share this post


Link to post
Share on other sites
Keith Vaugh

Trying to figure out these few things. Time to first byte last night was 0.460s 

Had everything working fine on DMS2 with load times of less than 4 seconds.... Migrated over to PL5 last night and trying to get the optimisation sorted now. Believe me, I'm not concerned of getting to 100%, just want to optimise as best I can. I managed 92% on DMS2. 

However when I exclude the maps.js I am getting an Uncaught ReferenceError: pl_do_shortcode is not defined (see above...) 

Share this post


Link to post
Share on other sites
Simon

Ho about turn off the caching and optimization to get a baseline.

The errors you are getting is concatenating all js into one file, the one file however is loaded in the wrong place and all the files inside it are in the wrong order.

Start by turning it all off, then try each option one at a time.

There is probably no way on earth you will get all js into the footer so you can get the green 'no js above the fold' or whatever it is. As you are probably using menus etc that are in the header and require js. You see the issue? If your site was plain old html then YES you can have 100 green no js above the fold because there is no js. You are chasing rainbows. 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×