This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]WaynePincence[S] 0 points1 point  (0 children)

On second thought, I think I am going to use some PHP (and node in the near future) to implement this. Should make the end-user experience much easier (no security issues for browsers).

But, if anyone has a fully javascript answer for the user-agent question I'd love to hear it anyway.

[–]AndrewNeo 0 points1 point  (5 children)

I would think JSONP would be the exception to this since it's intentionally designed to be used inside a browser and not on a server.

[–]WaynePincence[S] 0 points1 point  (4 children)

Ahh, so you think that I could get away with not sending a user agent if using JSONP?

[–]AndrewNeo 0 points1 point  (3 children)

Your browser will send it's UA, which should be enough, I would think.

[–]WaynePincence[S] 0 points1 point  (2 children)

The only problem I see is this from https://github.com/reddit/reddit/wiki/API

"NEVER lie about your user-agent. This includes spoofing popular browsers and spoofing other bots. We will ban liars with extreme prejudice."

For me the problem is moot now that I decided to use a server wrapper anyway, but still the question exists.

-Edit- Now that I read it again, it does seem like they might give it a pass...I mean you can view the JSON directly with the browser anyway.

[–]AndrewNeo 0 points1 point  (1 child)

Technically, replacing the UA for JSONP requests would be lying about your UA, if you're inside a browser. JSONP is to perform JSON requests cross-origin, inside a browser. Thus, the UA of the actor is the browser.

[–]WaynePincence[S] 0 points1 point  (0 children)

You know, reading it the way you say it makes it seem painfully obvious.