The situation
I am prototyping a web application of several pages, some of them with serious JavaScript load. I had the (not very original) idea of making the page layout load once, and only change the contents with ajax requests. This can be done, and it works nice, but I have some concerns.
The site check every request it gets, and if it is an AJAX request, it returns only the content (as an MVC 4 partial view, but that is not exactly the point, this can be done anywhere.) Otherwise, it loads the whole page, with layout, and everything. The idea is to have something like a status flag for each javascript bundle I'm downloading. The layout would have an initializing js file, containing the basic display logic of the page, how to get the contents, etc.
All the content pages would check, if their relevant scripts are loaded, if not, then initiate the download, and in the success event, set the correct flag. Some extra error-handling is required, for cases, when the ajax call fails for some reason.
The Question(s)
Now my concern is, there is quite much JS on some "subpages". Since I have to be able to work on mobile browsers (altough the most js-heavy stuff is desktop only, but let's forget that for a minute), how will it impact performance, if I have like several MB-s of scripts loaded in memory, and "never" unloading them (since the page is not reloaded). Also, will the scripts be cached, if I get them via the jQuery.getScript(...) function? Or should I load the scripts another way?
Same question for content. If I remove the DOM elements from the body, replace them with other elements, then reload the original subpage, what will that do with memory usage, and performance, during a long period of usage?
I would really like to have someone experienced in this field give me some insight on my concerns, before I make myself look completely stupid with a useless proof-of-concept prototype.
Thanks in advance!
EDIT: Changed title to proper expression
EDIT 2: Separated what is the question, and what is the context