Home › Forums › Other › A question about a little script I'm writing. › Reply To: A question about a little script I'm writing.
I’ll take a server-side snippet over something client-side any day of the week.
I’ll take the opposite view, and say “offload it to the client” whenever possible. It’s simply better for performance. Making chooseBackgroundColor()
a javascript function instead of PHP means taking some load off of your server (admittedly not much, but this sort of thing can add up), and potentially gives you a page that doesn’t even need to invoke the PHP parser anymore. This could also allow the page to be cached more freely, meaning some requests wouldn’t even hit your server.
edit
welcome back, Alen! Hope you enjoyed your trip