It depends on what you know about yourself, really.
The internet is one of those things that has lots of good, useful stuff, and then also lots of bad, sinful stuff. Unfortunately, sometimes when you’re looking for the good stuff, you’ll come across the bad stuff. That doesn’t mean you have to stop using the internet, or stop looking for the good stuff - necessarily.
If you’re in a place in your spiritual life where you can be looking for, say, a recipe for steak and accidentally come across a pornographic site, but just hit the back button and move on, no matter how often it happens, well then keep on using it. That’s how it is… it’s like going to the grocery store in the summer: you’re going to see some inappropriate clothes, but that doesn’t mean you don’t go buy food! You try your best to ignore it and move on. If you start not looking for good things because you might run into something bad, you’ll have to sit in a closet all day

.
However, we also have to consider two other things: your own place on the spiritual walk, and the relative risk to necessity of the good thing you’re trying to do. Going to the grocery store, or going to Mass are necessary. You
have to do it, and so no matter how weak you may be or how much risk there is versus the likelihood of seeing something bad, you need to go.
The internet, on the other hand, has a much, much higher risk of seeing something much worse than in a store or church, and it’s not nearly so necessary. Most of the time, it’s not necessary, other than when it is required for work, school, or some other thing. As such, if you are weak, there is a certain responsibility to stay away from it, or to make sure when using it you’re only going to those sites absolutely necessary, like the school webpage or whatnot.
What it comes down to is you. If you are looking up Mardi Gras for some good reason, or even for a neutral reason, and you are spiritually advanced enough to see these things, not sin, go back, and move on, then go ahead. On the other hand, if you’re
- weak so that after 3 or 4 of these sites popping up, you’ll give in to staying on one
- weak so that you may go back, but not before even briefly lusting after the image
- weak so that you may be able to move on, but the image will linger in your mind and gradually lead you into sin
or something similar, then based on that you need to at some point, depending on how weak you are and in what way, either get off the internet or stop looking up Mardi Gras.
With you, it sounds like you said it’s no big deal, moved on, and then it kept popping up, so over the minutes you started to get the thought you ought to turn it off so as to avoid these things, and you finally did. That would probably be virtuous, and not a sin.
The only ways (that I can think of) that it would be a sin would be if one of these were true:
- in between seeing the image and pressing back, you let yourself lust… this is a hard thing to judge sometimes, so don’t be too critical of yourself… if you feel like you really, truly lusted, then go confess it. If you aren’t sure, then don’t worry about it and perhaps mention it next time you go to confession regularly.
- You really and truly believed at the time that you needed to get off the net, that it was sinful if you didn’t, but you stayed on anyways for a while.
- You weren’t sure if you should get off, but thought it was possible, but you tried not to think about it for fear you’d decide you did need to. In this case, I wouldnt suspect it would be a mortal sin, but its possible.
- You, knowing yourself, knew that this was a real temptation to sin - not just a remote possibility, but an actual temptation that would be problematic - and you didn’t get off.
Otherwise, I really wouldn’t worry about it at all.