how to remove render-blocking JavaScript and CSS in fold content

Latest Reply from govind at 2014-02-15 06:02:21 Solution
i am using light cafe from 1 year
with my site http://www.premkurtis.com
when i check my speed with
https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.premkurtis.com%2F
error message shows
render-blocking JavaScript and CSS in above-the-fold content
how to resolve this problem please guide me.
Hi!
We don't recommend you to remove our java script. It is a very useful part of the theme. But you can disable your plugins and optimize your website.
http://maps.google.com/maps/api/js?sensor=false&ver=3
http://maps.gstatic.com/intl/en_us/mapfiles/api-3/15/6/main.js

i think this both scripts are for contact us page only. i am not using maps on every page. have any idea to remove this scripts except contact us page ?
still waiting for response i am using two paid templates.
Hi!
The first link is very useful for your contact form and for the proper work of google map shortcode. If you don't use the maps at all you can remove the code :
   wp_register_script( 'googlemaps', 'http://maps.google.com/maps/api/js?sensor=false', array( 'jquery' ), '3' );
wp_enqueue_script( 'googlemaps' );
from the file inc/library.php.
Probably, the other link is provided by your third party plugin. You can get rid of it, but I don't know what the file calls this script. If the page is not your contact page it doesn't contain the script.
i have solved my case
i have added this code to function.php
add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
function my_deregister_javascript() {
wp_deregister_script( 'googlemaps' );

}

and this lines to top.php
<?php if(is_page('62')): ?>
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<?php endif; ?>

'62' is my page id were i want to show google map.

Leave a reply

Add codeAdd image