"so I made almost all pages in a multipage document"
JQM doesn't work that way.
All.
Or none.
Pick one of the above.
You CANNOT mix multipage and single page!
- You cannot load a single-page from a multi-page
- You cannot load a multi-page from a single-page
It may APPEAR to kind of work - for specific navigations.
If you HAVE to jump back and forth from multi-page to single-page, you need to use universal JQM ejector seat, data-ajax="false" to navigate between the two. Of course, it will make a poor user experience.
This is why I always recommend never to use a multi-page document! If you do, you need to insure that your project is small, and you will always be happy with a single, multi-page document.
To go to an EXTERNAL page (not JQM) you ALWAYS have to use either rel="external" or data-ajax="false" (they both do exactly the same thing - it's just different semantics.) But I recommend instead when you go to an external site, you load into a different window, because otherwise you will replace your JQM document with the external document.
Since I think you are working on a Cordova app, I suggest you open external sites in the system browser instead of inside of your app. Or see of there is a Cordova setting or plugin that will let you work with more than one webview, and then load external documents into a separate webview, so that your main webview content is undisturbed.
And anyway, (I realize this is a school project, but for others...) at least for Apple App Store, your app will be rejected it it ceeds control of the webview to an external site. Although there is a way to return to your JQM webview on "back", the external site could always prevent "back"!
IF you were to (unadvisedly) load an external website into your webview, and the external site doesn't block "back", you COULD arrange to get back. But now you DO need to include the <head> contents in every page.
I hadn't thought about that scenario when I suggested you could leave out <head> contents except for the first page, because I never load an external site in a Cordova app, since it's just a very bad idea.
You should at least load any external site into an iFrame so that you cannot lose control of navigation.
I have seen too many bad Cordova apps that lead off to some external website, and then there is no way to get back! Probably the external site allowed back at one time, and then it changed, and then you need to restart the app if you should ever take that unfortunate off-site navigation.