Reputation: 53
I am trying to load multiple google maps on a single page, but page loading time is very high. How to speed up page loading time?
My example html code is below. Actually, below Google maps created in a loop and their number will be minimum 100.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places"></script>
<div id="postid_78" style="width:600px;height:150px;">
<script>
var mapProp = {
center: new google.maps.LatLng('42.5000', '1.5000'),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("postid_78"), mapProp);
var marker = new google.maps.Marker({
position: new google.maps.LatLng('42.5000', '1.5000'),
map: map
});
</script>
</div>
<hr />
<div id="postid_77" style="width:600px;height:150px;">
<script>
var mapProp = {
center: new google.maps.LatLng('42.5000', '1.5000'),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("postid_77"), mapProp);
var marker = new google.maps.Marker({
position: new google.maps.LatLng('42.5000', '1.5000'),
map: map
});
</script>
</div>
<hr />
<div id="postid_76" style="width:600px;height:150px;">
<script>
var mapProp = {
center: new google.maps.LatLng('42.5000', '1.5000'),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("postid_76"), mapProp);
var marker = new google.maps.Marker({
position: new google.maps.LatLng('42.5000', '1.5000'),
map: map
});
</script>
</div>
<hr />
<div id="postid_75" style="width:600px;height:150px;">
<script>
var mapProp = {
center: new google.maps.LatLng('42.5000', '1.5000'),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("postid_75"), mapProp);
var marker = new google.maps.Marker({
position: new google.maps.LatLng('42.5000', '1.5000'),
map: map
});
</script>
</div>
<hr />
<div id="postid_74" style="width:600px;height:150px;">
<script>
var mapProp = {
center: new google.maps.LatLng('42.5000', '1.5000'),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("postid_74"), mapProp);
var marker = new google.maps.Marker({
position: new google.maps.LatLng('42.5000', '1.5000'),
map: map
});
</script>
</div>
<hr />
<div id="postid_73" style="width:600px;height:150px;">
<script>
var mapProp = {
center: new google.maps.LatLng('42.5000', '1.5000'),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("postid_73"), mapProp);
var marker = new google.maps.Marker({
position: new google.maps.LatLng('42.5000', '1.5000'),
map: map
});
</script>
</div>
</body>
</html>
Upvotes: 1
Views: 711
Reputation: 1961
To improve the page load speed you can (must) do several things.
This should realy increase the page load. I've done this on several projects and it works fine!
Upvotes: 1