Skip to content

Commit 31a7bf3

Browse files
committed
web: Add config option to hide message when Ruffle restores from bfcache
1 parent a797456 commit 31a7bf3

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

web/packages/core/src/internal/player/inner.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,8 +2134,11 @@ export class InnerPlayer {
21342134
* Inform the user that the browser restored the file from the back/forward cache.
21352135
*/
21362136
protected displayRestoredFromBfcacheMessage(): void {
2137-
// Do not display the message if another one is already shown.
2138-
if (this.container.querySelector("#message-overlay") !== null) {
2137+
// Do not display the message if another one is already shown or website opted out.
2138+
if (
2139+
this.container.querySelector("#message-overlay") !== null ||
2140+
this.loadedConfig?.hideRestoredMessage
2141+
) {
21392142
return;
21402143
}
21412144
const message = textAsParagraphs("message-restored-from-bfcache");

web/packages/core/src/public/config/default.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const DEFAULT_CONFIG: Required<BaseLoadOptions> = {
2222
upgradeToHttps: true,
2323
compatibilityRules: true,
2424
favorFlash: true,
25+
hideRestoredMessage: false,
2526
warnOnUnsupportedContent: true,
2627
logLevel: LogLevel.Error,
2728
showSwfDownload: false,

web/packages/core/src/public/config/load-options.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,13 @@ export interface BaseLoadOptions {
450450
*/
451451
favorFlash?: boolean;
452452

453+
/**
454+
* Hide the message when content is restored from the back/forward cache.
455+
*
456+
* @default false
457+
*/
458+
hideRestoredMessage?: boolean;
459+
453460
/**
454461
* This is no longer used and does not affect anything.
455462
* It is only kept for backwards compatibility.

0 commit comments

Comments
 (0)