How does the integration of Google Maps in the web version work?

0

Hello! My question may seem a bit vague, but I did not know how to briefly synthesize my doubt. What I want to know is: how does Google Maps validate API_KEY and return map in web integration? Basically, the backend and frontend part I can turn around, but how does this Google Maps functionality validate API_KEY, call a callback, and render on the screen?

I do not know if you can understand the question, but it's not JS or backend. Basically, what resources / technologies would I need to know / study in order to create something similar (thinking about technology, not product)? Does it have something to do with mime-type or something like that?

    
asked by anonymous 10.05.2017 / 01:04

1 answer

0

I did a test and I managed to solve it. Basically, this is what I did:

C #

public HttpResponseMessage Index(string key)
{
    var response = new HttpResponseMessage();
    response.Content = new StringContent("function Console() { console.log('Funcionou - " + key + "'); }");
    response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/javascript");
    return response;
}

HTML

<script src="http://localhost:41852/api/Scripts?key=123456"></script>
<script>
    Console();
</script>

The Javascript returned by C # is integrated into my website and the Console function exists, without giving any error in the console saying that the function Console has not been defined.

    
10.05.2017 / 18:21