I’m afraid I’ve to start out this with a complete backstory, because the journey right here is the purpose, not a lot the theme.
A fella wrote to me some time again outlining a scenario he was in. His firm has a bunch of WordPress websites for public radio, lots of that are basically properties for podcasts. There’s one particular little bit of performance he thought could be supreme for all of them: to have a “pinned” audio participant. Like you can play a podcast, then proceed navigating across the web site with out that podcast stopping.
That is considerably tough to tug off in WordPress, as a result of WordPress does full web page reloads like some other common web site not doing something particular with hyperlink dealing with or historical past manipulation. When a web page reloads, any audio on the web page stops enjoying. That’s simply how the online works.
So how would you pull it off on a WordPress web site? Effectively, you can make it a headless WordPress web site and rebuild the whole front-end as a Single Web page App. Sounds enjoyable to me, however I’d be hesitant to make that decision simply for this one factor.
What else may you do? You can discover a method to make the web page by no means reload. I keep in mind doing this on somewhat static web site 10 years in the past, however that wasn’t a full blown WordPress web site and I didn’t even trouble updating the URL again then.
What for those who did this…
Intercept inner hyperlink clicksAjax’d the content material from that URLReplaced the content material on the web page with that new content material
Seems there may be extra to consider right here although. Are any inline scripts on the content material going to run? What about updating the <title> too? There are sufficient edge issues you most likely will get irritated coping with it.
Right here’s the factor although.
I simply don’t have time to complete this undertaking correctly. It was enjoyable to have a play, however my curiosity in it has kinda petered out. So I’ll go away it alone for now:
It nearly works, minus one obtrusive bug that the audio stops enjoying on the primary navigation, then works after that. I’m positive it’s fixable, however I simply don’t have a lot pores and skin on this recreation. I determine I’ll simply bow out and go away this code round for somebody to select up if it’s helpful for them.
One other factor at play right here is that Turbo is from Basecamp, and Basecamp has somewhat imploded lately making it not really feel nice to be utilizing their software program. Exacerbated by the truth that Sam Stephenson wrote 75% of Turbo and has mentioned he gained’t be touching it (or different associated initiatives) until the software program is moved to its personal basis. Turbo was already in a shaky place because it appeared buggy in comparison with Turbolinks, and now’s on very gnarly floor.
At Marketing Solution Australia we strive to deliverer elegant responsive websites for your business integrated with our personal SEO Optimization package to bring your pages on the first page of Google.