Lookup API request in Javscript (client-side request) - any chance ?

138 views
Skip to first unread message

matthias_123

unread,
Jun 4, 2012, 8:53:16 AM6/4/12
to Google Safe Browsing API
Hello !

I was wondering:
Is there a way the validate URLs via the safe brwosing lookup API by
using javascript Ajax / POST (preferable jQuery Ajax calls - but the
port. should not be a problem...)

All Examples seem to focus on server side requests

+ if a request from the client via javascript is possible, how would I
hide the API key (or restrict the requests to pages served from a
certain domain...) ?


THANKS A LOT FOR ANY HELP !
matthias

Sam Cleaver

unread,
Jun 5, 2012, 11:05:53 AM6/5/12
to Google Safe Browsing API
As far as I know there isn't a way to do it just from client-side. As
you point out, there is no way to hide you API key and it isn't locked
to a domain.
The simplest solution would be to use the lookup API in a simple
script and then have the client call that.

--Sam

EarlyAdopter

unread,
Jun 5, 2012, 10:56:46 PM6/5/12
to google-safe-...@googlegroups.com
Yeah, I agree - you don't want to expose your API key. Passing javascript/client requests through your own server/script would be the way to go.
 
That also gives you control to throttle usage, cache results, and reduce abuse to both your service and Google's lookup API.

matthias_123

unread,
Jun 6, 2012, 8:59:11 PM6/6/12
to google-safe-...@googlegroups.com

Pitty, I was hopping to generate my required functionalities without another request to the server - on the other hand caching the results, therefore possibly reducing the amount of requests to the lookup api endpoint seems plausible

Thanks for the replies !


Regards,
Matthias
Reply all
Reply to author
Forward
0 new messages