I was wondering if I felt someone had an XY problem (they have problem X but they go about it with Y and ask about Y rather than X), would it be appropriate to post an answer talking about a different way of going about a problem or would you comment first to clarify with the author of the question?
I've seen mixed experiences where someone was doing a problem one way, people suggested different solutions and they get downvoted because the author wanted it in that specific way.
I guess an example I had (kinda a while ago but it has come up and I want to make sure I'm going about it the right way) was this person was trying to find a way to direct users from one website via Javascript to other sites. I suggested in my answer that he should consider using header
in PHP
and some people commented that he specifically wanted Javascript while others said that it is appropriate to put these.
Thoughts on this? Wish I could find the question I answered. But I'm sure this has come up more than once. Thank you! Just trying to get more perspective.