I want to load a subpage in an iframe in the parent page. When the subpage is loaded in the iframe it should use another template then when it is loaded in a blank browser window. Is that possible?
Or is there a condition that checks the parent fo being an iframe?
Preferably the url also changes to the url of the subpage, and when you paste that url in the address bar, it would go to the parents page with the child loaded in the iframe.
Why use iframes in the first place?
There are almost always better architectural solutions then resorting to iframes.
Tell me more I obviously am not aware of those
The question is what is the purpose of using an iframe here? Please describe your use case.
That doesn’t make sense, you cannot show two different things using the same URL.
Here is an example: https://stimuleringsfonds.nl/
click on any article under news: the article loads on top of the site, and the url changes.
But if there is another way to inject the content of a page into another one that would help me a great bit. The template problem would then be easy to solve myself.
Using a different template is possible via Content Representations, in this case you would return a JSON representation to your calling AJAX call.
I’d suggest http://barba.js.org if you’re after strange/unique page loads.