36

Is it acceptable to ask a question where you have found a solution, but you don't know what the root cause of the problem was or why some bug was causing something to act some way?

I'm wondering this because I recently found an easy solution to a problem where (believe it or not) something was working on Internet Explorer and not on Chrome (and it wasn't malware)!

I still don't know why Chrome was/does behave the way it did in my situation but I know how to fix it. If I were on Stack Overflow would it be ok to post my code, my solution, and ask why I was getting this behavior or is this unacceptable?

7
  • 18
    You are going to come across more instances of something working on IE but not Chrome from now on. I guarantee it.
    – BoltClock
    Sep 17, 2015 at 17:58
  • 5
    This is a good question to ask - because unpicking what's going on and understanding it is exactly the sort of thing that's useful to future users of the site.
    – Sobrique
    Sep 18, 2015 at 8:50
  • And then edit a link into this question so we can see it. Sep 19, 2015 at 15:23
  • @AbraCadaver stackoverflow.com/q/32637062/1896169
    – Justin
    Sep 19, 2015 at 18:17
  • 1
    Does this answer your question? Are questions about why a solution worked acceptable?
    – Hong Ooi
    Mar 19, 2021 at 5:48
  • 1
    @HongOoi That linked question is already a duplicate of this one...
    – Tomerikoo
    Mar 19, 2021 at 11:30
  • 2
    @Hong Ooi: Whoa, are you a time traveler?!
    – BoltClock
    Mar 19, 2021 at 16:24

1 Answer 1

47

Yes, it's entirely acceptable to ask what was causing a problem, or why a piece of code solves it the way it does.

Be sure to include not just the problem description and code to reproduce it, but also the code that solves the problem, in your question, since the question revolves around precisely that code. Just keep in mind that some people don't read and will try to answer with a solution anyway even though you've already found one.

9
  • 7
    I don't see most of these kind of questions coming out well written though. Your answer needs to be taken with a grain of salt Sep 17, 2015 at 17:49
  • @πάντα ῥεῖ: Yeah, we'll have to see what the OP comes up with.
    – BoltClock
    Sep 17, 2015 at 17:49
  • You could probably flesh out with some pointers to the help center ;-). Sep 17, 2015 at 17:51
  • @πάντα ῥεῖ: I guess certain things do need to be spelled out every time...
    – BoltClock
    Sep 17, 2015 at 17:56
  • Thank you for the pointers (and the pointers on my question itself @BoltClock. The question is posted here: stackoverflow.com/questions/32637062/…
    – maxshuty
    Sep 17, 2015 at 18:09
  • @MaxPoshusta C#/Razor code in the post was not related to the question at all and caused somewhat random answer (which did not answer your question)... You should have stick with just JS/HTML (also at the end question is "why IE allows invalid Url to be used as window.location " which would be on the edge of "too broad") Sep 20, 2015 at 16:51
  • @Alexei Levenkov: I imagine it'd be a bit difficult to reduce their existing code into a test case absent of all Razor code though. I can see why the use of Html.Raw could have masked the issue somewhat. It was my idea that the OP add the [razor] tag to their question, and for that I apologize for the confusion.
    – BoltClock
    Sep 20, 2015 at 16:53
  • @BoltClock I hope it not too hard - the sample is one line of JavaScript - since it did not work properly I'd expect OP stepped through with JS debugger and knew exact value of the string generated by C#/Razor. Adding third language to the mix made actual question harder to spot - IE vs. Chrome. Based on OP's questions they have some knowledge of HTML, but indeed if OP does not know how to debug JavaScript or how to check HTML produced by server the question should be very different... Sep 20, 2015 at 17:01
  • @Alexei Levenkov: Fair enough.
    – BoltClock
    Sep 20, 2015 at 17:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .