I'm just wondering why ajax_get_redirect function add a random parameter around line 249:

$u['query'][mt_rand()] = 1;

For eg., when using ajax_register module, this leads to some weird url when login form (using ajax) is submitted: my_url?802334268=1.

Is there some good reason to add this random parameter? Or can the above line be safely commented/deleted?

Comments

peacog’s picture

I just spotted this too. I've commented out the line and everything's working so far. Does anyone know what it's for?

reg’s picture

subscribing

chawl’s picture

subs

kiphaas7’s picture

I'm guessing this is to work around some nasty IE caching bugs.

brendoncrawford’s picture

Status: Active » Closed (works as designed)

Kiphas is correct. This is a caching workaround. I currently know of no way to remove this without causing other side effects.

Henrik Opel’s picture

@brendoncrawford: Could you give a pointer to the IE bugs that make this workaround necessary?

reg’s picture

I wouldn't necessarily call it a bug, it's just the way IE works and we have to work around it so I don't know if there is a place we can point you to the "bug". However, developers have been dealing with IE caching issues forever, just do an Internet search and you will get more search results than you can read through.

Henrik Opel’s picture

@Reg: Thanks for the quick reaction.

[...] just do an Internet search and you will get more search results than you can read through.

That is exactly why I asked here specifically ;)

There is plenty of information on IE caching issues to be found, and there are many different/separate issues to start with (and I have dealt with my fair share of many of those as well).

However I do not know/see the concrete issue that needs to be worked around in the given context, i.e. standard redirection handling in Drupal does not seem to need the random query part, and its sudden usage by the ajax module is surprising.

So my question could be rephrased a bit more precisely: What concrete issues/problems caused the addition of the random query parameter to the ajax modules redirection logic?

reg’s picture

That's a good question and having just come across this issue here myself I don't know the answer anymore than you. Hopefully the author can chime on that one.

nibblebot’s picture

Status: Closed (works as designed) » Active

can author answer #8? I think it's appropriate to identify what specific problem this solves.

igor.ro’s picture

The links you provide looks like about IE caching ajax response if ajax send with GET.
Currently we have POST and this url returned is not the one we send ajax too.
So I think we can safely remove rand parameter,