I have tried to make a minimal example that doesn't involve any specific server side technology. So I have just generate the webpage with bash and serve it with cgi.
$ mkdir example
$ cd example
$ cat > index.html
<meta http-equiv="Refresh" content="0; url='/cgi-bin/index.html'" />
$ mkdir cgi-bin
$ cat > cgi-bin/index.html
#! /usr/bin/env bash
set -e
echo Content-Type: text/html
echo
sed "s/NEW/$RANDOM/g" << EOF
<html>
<head>
<title>DEMO</title>
<script src="/node_modules/@hotwired/turbo/dist/turbo.es2017-umd.js"></script>
</head>
<body>
<h1>DEMO</h1>
<p><small>lucky bonus number: $RANDOM</small></p>
<turbo-frame id='example-frame'>
<a href="?NEW">NEW turbo frame</a><br />
<a href="?NEW" data-turbo-frame="_top">NEW full page</a>
<p>number in query string: $QUERY_STRING</p>
</turbo-frame>
<br />
</body>
</html>
EOF
$ chmod +x cgi-bin/index.html
$ npm install --save @hotwired/turbo@7.0.1
$ python3 -m http.server --cgi # or whichever server
This creates a webpage that looks like this:
Then when you click on turbo frame reloader link, you get this:
The lucky bonus number has not changed because it only loaded the turbo frame, but the query string number, which is displayed inside the turbo frame has been updated.
The full page turbo link does this:
It updates the lucky bonus number (content outside the turbo frame) and updates the url. (I am sure it is working properly though. I have checked the network tab. It is only doing a fetch each time.)
What I would like to do:
I would like to have a link that only updates the turbo frame (leaves the lucky bonus number unchanged in my example) but also updates the url. I guess the use case is if you have a banner or menu that always stays the same, but a primary turbo frame with all the page specific content that should correspond to the url.
So in this example, I would like to see both the query string on the page, and the actual query string update, leaving only the "lucky bonus number" unchanged.