Skip to content

Commit

Permalink
Introduce warning message for Safari 13 and below (#18258)
Browse files Browse the repository at this point in the history
Discourse will be dropping support for these browsers in early 2023. https://meta.discourse.org/t/224747
  • Loading branch information
davidtaylorhq committed Sep 16, 2022
1 parent 4af080d commit 3904c23
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
@@ -0,0 +1,30 @@
import I18n from "I18n";
import { withPluginApi } from "discourse/lib/plugin-api";

function setupMessage(api) {
const isSafari = navigator.vendor === "Apple Computer, Inc.";
if (!isSafari) {
return;
}

let safariMajorVersion = navigator.userAgent.match(/Version\/(\d+)\./)?.[1];
safariMajorVersion = safariMajorVersion
? parseInt(safariMajorVersion, 10)
: null;

if (safariMajorVersion && safariMajorVersion <= 13) {
api.addGlobalNotice(
I18n.t("safari_13_warning"),
"browser-deprecation-warning",
{ dismissable: true, dismissDuration: moment.duration(1, "week") }
);
}
}

export default {
name: "safari-13-deprecation",

initialize() {
withPluginApi("0.8.37", setupMessage);
},
};
2 changes: 2 additions & 0 deletions config/locales/client.en.yml
Expand Up @@ -3731,6 +3731,8 @@ en:

browser_update: 'Unfortunately, <a href="https://www.discourse.org/faq/#browser">your browser is unsupported</a>. Please <a href="https://browsehappy.com">switch to a supported browser</a> to view rich content, log in and reply.'

safari_13_warning: This site will soon remove support for iOS and Safari versions 13 and below - please update your browser

permission_types:
full: "Create / Reply / See"
create_post: "Reply / See"
Expand Down

1 comment on commit 3904c23

@discoursebot
Copy link

Choose a reason for hiding this comment

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

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/maintaining-support-for-ios-12-5-until-january-2023/224747/21

Please sign in to comment.