0

In my layout. I render the script.

@Scripts.Render("https://maps.googleapis.com/maps/api/js?key=AIzaSyAPKeBYFqGsbfGiH7wvx1mMH9A4I")

But the console will give me a warning: Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys

How to solve this problem.

4
  • If that is you actual key in there you should remove that ASAP. Also, how does the actual HTML look like on the client? Commented Oct 28, 2016 at 20:47
  • @Lucero If that is you actual key in there you should remove that ASAP. PO is correct; API key is required to include in the URL. Commented Oct 28, 2016 at 21:05
  • @Win I meant remove from the question, not from the HTML of course. Commented Oct 28, 2016 at 21:08
  • @Lucero As I said, we cannot do anything with it, and no one can make anything out of it. Primary purpose of key is for Google to keep track of usage. It was not required in V2, but required again in V3. Commented Oct 28, 2016 at 21:23

1 Answer 1

2

Scripts.Render is for compressing and minifying JavaScript files.

You do not want and need to compress or minifying Google Map JavaScript file.

So, just use normal script tag.

<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAPKeBYFqGsbfGiH7wvx1mMH9A4I" 
    type="text/javascript"></script>

Besides, it is not how you use Scripts.Render, but it should be something like @Scripts.Render("~/bundles/scripts"). Read more here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.