Read about Hashbangs, which allow you to dynamically upload content to web pages.
I will not comment on whether to use the server side, Javascript or just a responsive design, as you specifically mentioned Javascript.
From google
This document describes an agreement between web servers and search engines that allows dynamically generated content to be visible to crawlers. Google currently supports this agreement. We hope that other search engines will also accept this offer.
source share