Is it possible to buy tickets for St John's Cathedral online? The website does not say.
It appears that there is no web option. Our tickets were bought directly on site last September. Be sure to get there first thing in the AM - it gets extremely crowded.
There is a Heritage Malta Pass that covers a lot of other attractions, but not St. John's. Here is the link to that in case it may be worthwhile:
http://www.heritagemalta.org/images/hmbrochure.pdf
PS. I also highly recommend seeing the Ħal Saflieni Hypogeum, but you need to reserve ahead of time because they only allow a limited number of folks at once:
Middle of the day is when cruise-ship passengers swarm the centre of this small city. So yes, earlier or later will be more comfortable.