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.

SHAN KEVIN
  • 11
  • 3
  • If that is you actual key in there you should remove that ASAP. Also, how does the actual HTML look like on the client? – Lucero Oct 28 '16 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. – Win Oct 28 '16 at 21:05
  • @Win I meant remove from the question, not from the HTML of course. – Lucero Oct 28 '16 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. – Win Oct 28 '16 at 21:23

1 Answers1

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.

Community
  • 1
  • 1
Win
  • 61,100
  • 13
  • 102
  • 181