Yes, improvisation can be learned online. At least, the theories and methods for improvising can be learned. Improvisation, however, isn't just something you know, it is something you do. The theories and techniques for improvising that you learn, only become real for you when you spend a lot of time on your own actually trying to improvise. This often takes a lot of time and feels a bit awkward at first.
I think it helps to have a plan for studying improvising. Identify problems and create exercises to solve those problems. Here's where having a good teacher helps a lot. A basic problem might be improvising over a G7 chord. There are many ways of playing this chord and many scales that will fit this chord. For my own development, I will create an exercise where I identify a particular voicing for the chord on my guitar and a particular scale or bit of melodic material with which I want to improvise. I will alternate playing the chord and improvising short melodic phrases. My metronome helps me keep the time slow and steady. My goal is to get comfortable with the chord voicing, the scale, and that particular portion of the guitar neck. I keep it fairly simple until it feels comfortable. Then I move it around or develop it in other ways.
This is something I do after I learn something online. You can learn the ideas online, but you need to develop them on your own playing your instrument.