Skip to content

Commit 087b08d

Browse files
authored
Setting the baseUrl ad a referrer when loading the reader webview url (#22349)
1 parent 8addd1e commit 087b08d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostRenderer.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,12 @@ class ReaderPostRenderer(
162162

163163
// IMPORTANT: use loadDataWithBaseURL() since loadData() may fail
164164
// https://code.google.com/p/android/issues/detail?id=4401
165-
// also important to use null as the baseUrl since onPageFinished
166-
// doesn't appear to fire when it's set to an actual url
165+
// Use android-app:// scheme as baseUrl to set HTTP referrer for YouTube embeds.
166+
// Google requires this for embedded videos to work properly.
167+
// https://developers.google.com/youtube/terms/required-minimum-functionality#set-the-referer
168+
// https://stackoverflow.com/questions/79761743/youtube-video-in-webview-gives-error-code-153-on-android/79809094#79809094
167169
webView.loadDataWithBaseURL(
168-
null,
170+
"https://wordpress.com/reader",
169171
htmlContent,
170172
"text/html",
171173
"UTF-8",

0 commit comments

Comments
 (0)