NetTalk Central

Author Topic: Including Google Maps script error  (Read 5282 times)

debraballenger

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • Email
Including Google Maps script error
« on: October 23, 2013, 04:02:44 PM »
In my app I need to calculate the shortest driving distance between 2 addresses.  I have a custom script that I am including in the webserver procdure.  And I use a function from that procedure behind a button to get the distance, display it and write it to the database.

However when I include the google maps API I am getting the following error.  The Google maps api server rejected your request.  The sensor parameter specified in the request must be set to either true or false.

I can use this code in an html page and I do not get this error, so I think there is something incompatible, but I am not sure what.  I have included an example app.

Does anyone have suggestions for what I need to do differently?
My environment is C8 9759 and NT 7.25
Thanks,
Debra

[attachment deleted by admin]

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Including Google Maps script error
« Reply #1 on: October 23, 2013, 05:32:24 PM »
Hi Debra,

I haven't done this nor did I look at your app, so FWIT:

When including the Google API it needs to be more than just a normal script definition, it needs to pass a parameter:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>

Check your HTML <head> section to see if you have the correct definition.

Regards
Bill

debraballenger

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • Email
Re: Including Google Maps script error
« Reply #2 on: October 23, 2013, 05:52:35 PM »
I probably should have mentioned that in my post  :)  But yes I have that with the sensor=false in the webserver scripts section.  And it appears in the source of my page.  So thats why I am stumped.  Although it does have an extra ?c at the end that I did not put there... so its odd.

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Including Google Maps script error
« Reply #3 on: October 23, 2013, 06:57:26 PM »
if it looks like

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true?c"></script>

Then it won't work.

Its the AutoCheckCache option, you'll need to turn it off.

Its an extension off your main window, on the advanced tab.

debraballenger

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • Email
Re: Including Google Maps script error
« Reply #4 on: October 24, 2013, 06:03:34 AM »
Thanks Bill, that helped.  I also had to change the ? to an & before the sensor.  So my script tag looks like this
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false" type="text/javascript"></script>

By turning off the Auto Check Cache, am I hurting anything?  Do I need to do something extra in my code to account for this?

Thanks again!

Debra

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Including Google Maps script error
« Reply #5 on: October 24, 2013, 09:32:56 AM »
Hi Debra,

see
http://www.capesoft.com/docs/NetTalk7/NetTalkWebFunctionality.htm#WebserverAdvanced

I will look to see if we can keep that setting on for hand-coded scripts though in an upcoming build.

Cheers
Bruce

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Including Google Maps script error
« Reply #6 on: October 25, 2013, 03:47:17 AM »
For 7.28 I've added a setting so you can suppress the cache-check specifically on the javascript file that takes parameters.

Better yet, it's a bit smarter now about recognizing there are already parameters, and hence formatting the parameter a bit better. So it might work better even with it on.

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Including Google Maps script error
« Reply #7 on: October 25, 2013, 04:49:50 AM »
Cool