Reputation: 8276
Let's assume that I load a filtering page, and based of an earlier set cookie, I want to reload the page by adding a few query parameters to my url. Something like this:
<head>
<script>
if (need_to_load_with_different_params) {
window.location.href = window.location.href + params_from_cookie;
}
</script>
</head>
I don't remember seeing web applications using this kind of pattern. Is there a good reason for that? Should I move such logic to server-side by all means?
(using jquery.cookie
to simplify cookie reading if that makes any difference)
Upvotes: 3
Views: 1303
Reputation: 1671
As commented by @Rory McCrossan, it would be better to do this server side.
Several reasons for that:
Original Answer: It shouldn't be considered secure: in any case the rest of the content of the page will be downloaded by the user (if JavaScript is disabled, the redirect won't happen)
Upvotes: 3