question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Override isHTML or locationIsVisitable?

See original GitHub issue

Hello!

With turbolinks I used to do this:

Turbolinks.Location.prototype.isHTML = () => true;

Is this no longer possible with Turbo?

The default extension regex often trips me up, as a PHP developer I obviously expect <turbo-frame id="messages" src="/messages.php">msg</turbo-frame> to work.

In my case some of my URLs happen to have periods in them, which Turbo fails to load correctly (e.g. /music/prince/1989.batman) because it parses the “.batman” part as the extension.

I also tried setting data-turbo=true, as setting data-turbo=false forces links to not be navigable or visitable, so I figured maybe data-turbo=true forces it in the other direction, but it seems to just give me the default behavior.

For now, the workaround I’m using is making sure my URLs end in a slash, as that seems to bypass the extension check, but it would be nice if there was some way to force Turbo to treat a particular link as navigable/visitable.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ajlivecommented, Sep 24, 2021

I’d like to present an argument that this issue should be a little higher priority: Hotwire is being marketed as being about JS on the client and HTML on the server, not as an extension of Ruby on Rails, so it seems strange that it excludes many PHP sites, which last I checked still accounts for some 80% of server-side code on the web. Yes, not all of PHP sites out there use urls that end in .php, but I’m not sure why Turbo, as a client JS library, cares what my urls look like.

My team would be happy to work with maintainers to find a more acceptable way to configure than isHTML and make a PR. I’d love to hear any response from the maintainers about this, even if it’s “wont fix” so that I know we need to fork turbo.

2reactions
kasperkampermancommented, Jul 29, 2021

Indeed it would be great if Turbo would support other extensions like .php as well. I know it’s now part of the Rails community, but I think it’s a great and easy way to create a SPA experience with PHP generated websites as well in a very simple way (Laravel Livewire needs Laravel).

See also my discussion topic at: https://discuss.hotwired.dev/t/how-to-make-turbo-drive-work-with-php-files-and-query-strings/2020

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make Turbo Drive work with php files and query ...
There is a GitHub issue, Override isHTML or locationIsVisitable? · Issue #185 · hotwired/turbo (github.com), but it is still open.
Read more >
Check if a string is html or not
I have a certain string for which I want to check if it is a html or not. I am using regex for...
Read more >
Using Price Action As Your First Indicator in Technical Analysis ...
Price action is the study or analysis of price movement in the market. Traders use price action to form opinions and base their...
Read more >
Dollar Forecast Loaded with Volatility Potential but Can It Find a ...
Event danger forward is dense and will overlap by way of market-moving potential, notably between Tuesday's CPI and Wednesday's FOMC determination; Market ...
Read more >
Bitcoin Falling Wedge, Ethereum Triangle: Continued Consolidation ...
startsWith(url)}operate locationIsVisitable(location2,rootLocation){return isPrefixedBy(location2,rootLocation)&&operate isHTML(url).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found