mirror of https://github.com/Chocobozzz/PeerTube
Display a message in embed on unsupported web browser
parent
f4e75a6fd0
commit
c21a0aa855
|
@ -44,5 +44,31 @@
|
||||||
|
|
||||||
<div id="placeholder-preview"></div>
|
<div id="placeholder-preview"></div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
// Can be called in embed.ts
|
||||||
|
window.displayIncompatibleBrowser = function () {
|
||||||
|
const text = 'The player is not compatible with your web browser. Please try latest Firefox version.'
|
||||||
|
|
||||||
|
document.title = 'Sorry' + ' - ' + text
|
||||||
|
|
||||||
|
const errorBlock = document.getElementById('error-block')
|
||||||
|
errorBlock.style.display = 'flex'
|
||||||
|
|
||||||
|
const errorTitle = document.getElementById('error-title')
|
||||||
|
errorTitle.innerHTML = 'Sorry'
|
||||||
|
|
||||||
|
const errorText = document.getElementById('error-content')
|
||||||
|
errorText.innerHTML = text
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onerror = function () {
|
||||||
|
window.displayIncompatibleBrowser()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/MSIE|Trident/.test(window.navigator.userAgent) ) {
|
||||||
|
window.displayIncompatibleBrowser()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -258,12 +258,8 @@ export class PeerTubeEmbed {
|
||||||
}
|
}
|
||||||
|
|
||||||
async init () {
|
async init () {
|
||||||
try {
|
this.userTokens = Tokens.load()
|
||||||
this.userTokens = Tokens.load()
|
await this.initCore()
|
||||||
await this.initCore()
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private initializeApi () {
|
private initializeApi () {
|
||||||
|
@ -791,4 +787,8 @@ export class PeerTubeEmbed {
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerTubeEmbed.main()
|
PeerTubeEmbed.main()
|
||||||
.catch(err => console.error('Cannot init embed.', err))
|
.catch(err => {
|
||||||
|
(window as any).displayIncompatibleBrowser()
|
||||||
|
|
||||||
|
console.error('Cannot init embed.', err)
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in New Issue