Welcome Guest, Not a member yet? Register   Sign In
Poll: Ajax library?
You do not have permission to vote in this poll.
yes
36.73%
18 36.73%
no
51.02%
25 51.02%
maybe
12.24%
6 12.24%
Total 49 vote(s) 100%
* You voted for this item. [Show Results]

[split] Ajax library?
#13

(04-14-2015, 06:40 PM)blocSonic Wrote: The same way other frameworks do. I can't tell you what it is they do to determine it, but they do. It's not unrealistic to expect a framework to provide this ability.

I have yet to find a framework which determines whether a request is an AJAX request with any method other than that used by $this->input->is_ajax_request().

Further, most of them don't go significantly further than CI does in this respect by providing a method to check whether the request included the X-Requested-With header. The fact that this method is unreliable is the same across frameworks.

http://stackoverflow.com/questions/18260...t-with-php

As mentioned in the link above, there is no method of determining whether a particular request was an AJAX request which can not be spoofed, because all of them depend on the client. CSRF checks and other methods help, but, in the end, the client could still send a normal request disguised as an AJAX request.

Further, the client could send a valid AJAX request without the header, or the server could prevent the header from being passed to CI.

For these reasons, any controller method/action which is intended to be called by an AJAX request should always respond as it would to an AJAX request. I'm as guilty as anyone else of attempting to change the behavior of a method based on the presence of the X-Requested-With header, but it's a waste of time.
Reply


Messages In This Thread
[split] Ajax library? - by paysalkharis - 04-06-2015, 09:19 PM
RE: [split] Ajax library? - by sv3tli0 - 04-06-2015, 10:14 PM
RE: [split] Ajax library? - by albertleao - 04-06-2015, 10:52 PM
RE: [split] Ajax library? - by salain - 04-06-2015, 11:23 PM
RE: [split] Ajax library? - by silentium - 04-06-2015, 11:37 PM
RE: [split] Ajax library? - by nasser.man - 04-07-2015, 12:11 AM
RE: [split] Ajax library? - by dmyers - 04-08-2015, 05:52 AM
RE: [split] Ajax library? - by blocSonic - 04-10-2015, 05:05 PM
RE: [split] Ajax library? - by mwhitney - 04-14-2015, 09:44 AM
RE: [split] Ajax library? - by blocSonic - 04-14-2015, 06:40 PM
RE: [split] Ajax library? - by mwhitney - 04-16-2015, 06:49 AM
RE: [split] Ajax library? - by albert.freeman - 04-13-2015, 03:34 PM
RE: [split] Ajax library? - by sv3tli0 - 04-14-2015, 11:42 PM
RE: [split] Ajax library? - by Razican - 04-20-2015, 03:39 AM
RE: [split] Ajax library? - by PaulD - 04-20-2015, 07:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB