GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
I was wondering for a while, why JQM AJAX requested pages always were considerably large on my application.
Eventually I checked the response and - making perfect sense - JQM does pull in the full page and then discards everything outside <div data-role="page"></div>. In my case my header included a lot of stuff required when loading the app. On subsequent pages I don't need any of it (it's already there), but it gets requested with every page and is promptly dumped when JQM starts enhancing the page.
Maybe add some infos to the docs clarifying this,because it sure saves traffic skipping these parts when building pages requested by AJAX on the server.
I don't think it's a good idea to skip "these parts" (scripts) on subsequent pages because the page would break when the user refreshes the page.
I see. But refreshing will refetch the whole page won't it?
In my case all my page headers look like this server-side (Coldfusion):
<cfif NOT isAjaxRequest()>
isAjaxRequest checks if the page was requested by Ajax. If no Ajax, the user refreshed or is starting on this page, so I'm including the whole header. If requested by Ajax, it's JQM, so I'm saving a few k by leaving all the stuff, JQM will disregard anyway.
Seems to work fine. Still, I'm currently looking into offline-ing pages, for which I will probably have to switch to full (static pages) including header.
Sorry, I misinterpreted "skipping". Thought you meant leaving it out completely.