Can't Display Polylines on a Google Map

You can use the Google Maps on your own website to provide a range of useful services. One feature available via the API is the polyline feature to join two markers using a line. This has many good uses where two markers need to be associated with each other.

Description

Unfortunately there is a common problem where the polyline wont display , and there will be no obvious error messages. After some research a fix was found to this problem.

This issue is more likely to occur in Internet Explorer.

Solution

Place to following code inside the <head> tag of your page

<style type="text/css"> 
v\:* {
behavior:url(#default#VML);
}
</style>

Also , use :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">

in the header instead of....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

Relevant Links

https://developers.google.com/maps/documentation/javascript/

Version History

Version Date Description
1.0 18/01/2006
2.0 02/05/2007
3.0 11/11/2007

Comments For This Page

I don't understand why this work.... But THANK YOU SO MUCH!!!!
By joaco on 28th February 2016
Thank you soooooooooo much!
I've been struggling with this for quite a while now.
By Stefan on 18th August 2011
Hi! I'm suffering this problem too and I'm interested about the concrete reason this is happening.
Where have you found the info to fix the problem? Thanks!
On 14th September 2010

Add your own comment below and let others know what you think: