6 ms·
> So you might be wondering, hey, how did you make a javascript applet ping these arbitrary servers? What about cross-domain request protection? > Answer: I di
by herpderperator 4y ago
> So you might be wondering, hey, how did you make a javascript applet ping these arbitrary servers? What about cross-domain request protection?
> Answer: I did it by just making the queries anyway, and seeing how long it takes to get the error message back that my request was refused because of cross-domain request protection. Yes, this results in an infinite number of error messages to your javascript console. Don't look at your javascript console and you'll be fine. Trust me on this.
- zeptonaut22 4y agoLove the cleverness here. I was literally wondering this exact thing as I read through the documentation. I'm hoping to use his WiFi debugging guidance from the readme at my in-laws: I was just experiencing remote desktop problems despite having a strong network connection. I suspect the culprit is Comcast's supplied router.
- RockRobotRock 4y agoThat's hilarious, and probably explains why it takes a few seconds before it starts working.
- sublinear 4y agoNot so clever after all. I haven't even opened dev tools yet and I suspect this technique is why it stops working and gives many people the solid bar. The server probably just stops responding after too many failed requests. Oops!
- thakoppno 4y agoAlso highlights an aspect of CORS that is occasionally misunderstood. The client sends the request no matter what. The response headers dictate whether the response is usable.
- Mavvie 4y agoKeep in mind this is only true for requests that don't require a preflight check. This also means if you rely on CORS to prevent XSRF attacks (which is maybe not the best idea), you must be ensuring that any request that came in would have been preflighted (for example, reject requests unless they have a special header)
- apenwarr 4y agoHowever, the preflight check is sufficient to check latency :) "Preflight check" is such a wrong analogy, since with CORS you fly all the way to the destination to check if you're allowed to fly to the destination.
- other_herbert 4y agoIt’s more of a cargo check, you fly all the way there to see if they’ll let you take some cargo back with you *cargo isn’t really the right analogy… but close enough
- jrockway 4y agoCustoms check basically. If you aren't allowed to bring something into the country you land in, they simply confiscate it when you get there. (And I'm sure arrest you and make you miserable because ... that's what justice is I guess.)
- TeMPOraL 4y agoDepends on the destination country and on exactly what it was you were trying to bring in with you. Nah, the whole thing is just a "Can I ask you a question?" implemented in code.
- deleted 4y ago[deleted]