"What do you like to do online?"
Inverting 上网 and 喜欢 should be accepted because it's the same meaning. In many language you would say the same
I believe 上网 means "to go online" and has a verb usage. You might be thinking of "online" as a place, in which case a location is typically used before the verb with 在.
A literal translation for what you suggested would read:
"You go online like to do what?"
Duo's translation reads:
"You like to go online to do what?"
Even in English, it is more natural to say 喜欢上网 (like to go online).