Skip to content

Hide native title when HTML <title> is not present or blank#204

Open
leonvogt wants to merge 1 commit into
hotwired:mainfrom
leonvogt:hide-title
Open

Hide native title when HTML <title> is not present or blank#204
leonvogt wants to merge 1 commit into
hotwired:mainfrom
leonvogt:hide-title

Conversation

@leonvogt

Copy link
Copy Markdown
Contributor

Android's WebView returns the URL when a page has no HTML <title>.
With this PR, instead of showing the URL, it shows nothing - like in Hotwire Native iOS.

Comment on lines +392 to +395
substringAfter("://")
.removePrefix("www.")
.replace("%20", " ")
.trimEnd('/')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First I had a simpler check, but the problem is that, webView.url contains the schema while webView.title doesnt':

webView.url = http://192.168.42.51:3000/dashboard
webView.title = 192.168.42.51:3000/dashboard

To also handle the case of www.domain.com sites, we we normalize both strings the same way before comparing them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant