A Google Maps JavaScript API v3 library to validate self-intersecting an exisiting polygon.
Add the Google Maps JavaScript API version 3 with the geometry library.
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry"></script>
Add the polyintersect.js file.
<script type="text/javascript" src="js/polyintersect.min.js"></script>
Initialize a map with a polygon.
Call .validate() method on your polygon to validate self-intersecting whole polygon or can call .validate(index) to validate polygon vertex.