Intermittent connection issues

I have an intermittent internet connection that is on and off every minute or so for a second or two at a time and this normally has virtually no impact on my general internet use, however when using codecademy, it triggers the “are you still there” dialog very frequently. any ideas how to stop this from happening?