Advertisement:

Author Topic: Google Maps shows for some milliseconds and then stops  (Read 5926 times)

slowfood

  • Newbie
  • *
  • Posts: 4
Re: Google Maps shows for some milliseconds and then stops
« Reply #15 on: August 12, 2017, 06:49:23 pm »
Usage of the Google Maps APIs now requires a key.
If you are using the Google Maps API on localhost or your domain was not active prior to June 22nd, 2016, it will require a key going forward. To fix this problem, please see the Google Maps APIs documentation to get a key and add it to your application: https://developers.google.com/maps/documentation/javascript/get-api-key
Locate the file that contains the Google Maps script code on your website, and append your API key to it as a parameter:
1
<script src="//maps.googleapis.com/maps/api/js?key=YOUR_API_KEY" async="" defer="defer" type="text/javascript"></script>
If there aren’t other parameters, just add ?key=YOUR_API_KEY at the very end of the src path; otherwise, add &key=YOUR_API_KEY instead, like this:
1
<script src="//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=YOUR_API_KEY" async="" defer="defer" type="text/javascript"></script>
Obviously, in both cases you must replace YOUR_API_KEY with your actual API key code.
6.  Enjoy!

LOL. This solve is only worked on unspecific problems. How can you find this command lines in osclass? Google maps plugin have only one code sequence for this key

Google Maps Plugin index.php file 18-22 lines
Code: [Select]
// HELPER
    function osc_google_maps_header() {
        echo '<script src="https://maps.google.com/maps/api/js?sensor=false&key='.osc_get_preference('maps_key', 'google_maps').'" type="text/javascript"></script>';
        echo '<style>#itemMap img { max-width: 140em; } </style>';
    }

When we are insert the correct API KEY code it's not working. İnserted area is in;

admin/settings.php file 26-35 lines
Code: [Select]
<div class="form-horizontal">
        <div class="form-label"><?php _e('Google Maps API key.''google_maps'); ?></div>
        <div class="form-controls">
            <div class="form-label-checkbox">
                <input type="text" value="<?php echo osc_esc_html(osc_get_preference('maps_key''google_maps')); ?>" name="maps_key"/>
                <br>
                <p><span class="help-box"><?php _e('Create an API key as per instructions here: <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">Get api key</a>''google_maps'); ?></span></p>
            </div>
        </div>
    </div>

All modifications and solutions trying but I have this message again again and again;

"Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error"

"Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys"

Please don't say this "This Subject is solved." NOT SOLVED.

slowfood

  • Newbie
  • *
  • Posts: 4
Re: Google Maps shows for some milliseconds and then stops
« Reply #16 on: August 12, 2017, 07:03:05 pm »
I found that the only solution that works. ONLY!

Add this code to footer.php file in your theme files;

Code: [Select]
<!--Google Maps JavaScript API -->
<script src="https://maps.googleapis.com/maps/api/js?key=CHANGE WITH YOUR API KEY HERE"
 type="text/javascript"></script>

Google maps plugin and google maps plus plugin not working without this solution.

Good Works.
« Last Edit: August 12, 2017, 07:04:45 pm by slowfood »