wordpress - enabling CORS on apache -
i trying enable cors not workign me. runnign centos 6.5 apache. aplication wordpress. have tried following.
set header in template file
set header in
.htaccess
http://enable-cors.org/server_apache.htmlheader set access-control-allow-origin "*"
restarted apache. still error:
cross-origin request blocked: same origin policy disallows reading remote resource @ https://gateway.spectrumasa.com/dev/mcmap/test-geosml3.kmz. can fixed moving resource same domain or enabling cors.
i trying create geoxml3 kml polygon tooltip on mouseover instead of click
below code have on template.
<!-- <script type="text/javascript" src="<?=get_site_url(); ?>/wp-content/themes/twentytwelve-child/js/geoxml3.js.1"></script> <script type="text/javascript" src="<?=get_site_url(); ?>/wp-content/themes/twentytwelve-child/js/projectedoverlay.js"></script>--> <script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src/infobubble.js"></script> <script type="text/javascript" src="http://geoxml3.googlecode.com/svn/branches/polys/geoxml3.js"></script> <script type="text/javascript" src="http://geoxml3.googlecode.com/svn/trunk/projectedoverlay.js"></script> <?php header('access-control-allow-origin: *');?> <script type="text/javascript"> var geoxmldoc = null; var map = null; jquery(document).ready(function () { var myoptions = { center: new google.maps.latlng(-19.5968657,-40.7717683), zoom: 6, maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); var geoxml = new geoxml3.parser({ map: map, singleinfowindow: true, afterparse: usethedata }); geoxml.parse('https://gateway.spectrumasa.com/dev/mcmap/test-geosml3.kmz'); // alert("done init"); } ); function usethedata(doc) { // geodata handling goes here, using json properties of doc object geoxmldoc = doc; (var = 0; < doc[0].placemarks.length; i++) { var placemark = doc[0].placemarks[i]; polygonmouseover(placemark.polygon,placemark.name); // console.log(doc[0].markers[i].title); jquery('#map_text').append(doc[0].placemarks[i].name + ', '); } }; var ib = new infobubble({ shadowstyle: 0, padding: 0, backgroundcolor: 'white', borderradius: 4, arrowsize: 0, borderwidth: 1, bordercolor: 'black', disableautopan: true, hideclosebutton: true, arrowposition: 50, arrowstyle: 0 }); function polygonmouseover(poly, text) { google.maps.event.addlistener(poly,'mouseover', function(evt) { ib.setcontent(text); ib.setposition(evt.latlng); ib.setmap(map); ib.open() }); google.maps.event.addlistener(poly,'mouseout', function(evt) { ib.close() }); } </script> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <div id="container" class="three_column_middle"> <div id="content" role="main"> <?php if($post->post_parent){?> <div class="section_title"><?php echo get_the_title(); ?></div> <?php }?> <div class="second-conent-container"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'page' ); ?> <?php comments_template( '', true ); ?> <?php endwhile; // end of loop. ?> <div id="map_canvas" style="width:600px;height:500px;"></div> <div id="map_text"></div> </div> </div><!-- #content --> </div><!-- #container --> <?php get_sidebar('right'); ?> </div></div><!-- #3 column container --> <?php get_footer(); ?>
on gateway proxy lookup public access
proxypassreverse /dev/mcmap http://172.16.0.29/mcmap proxypass /dev/mcmap http://172.16.0.29/mcmap proxypassreverse /dev/knowledgemap http://172.16.0.29/mcmap proxypass /dev/knowledgemap http://172.16.0.29/mcmap
after reading http://g00se.org/2013/07/reverse-proxy-with-cors.html have added
<locationmatch "/dev/mcmap"> header add "access-control-allow-origin" "*" header set access-control-allow-headers "origin, x-requested-with, content-type, accept" </locationmatch>
the cors policy on https://gateway.spectrumasa.com/dev/mcmap/test-geosml3.kmz need updated, not on own domain deliver javascript needs spectrumasa.com.
maybe mirror content.
Comments
Post a Comment