Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't merge this #33

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/components/UnsupportedBrowserMsg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ export const UnsupportedBrowserMsg: FC = () => {
const history = useHistory();
const [open, setOpen] = useState(true);

React.useEffect(() => {
navigator.registerProtocolHandler(
'web+safarita',
'https://pr-33.d3pqoo7mq9yhwf.amplifyapp.com/?src=%s',
'Safari'
);
Comment on lines +22 to +26
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ajsamra this is how to use registerProtocolHandler. See my links in main PR thread, but basically the params are:

  1. The scheme to use. I think custom web-based ones have to be prefixed with web+
  2. The url that will be used when an href is set to the scheme. I found mixed instructions but most say:
    • The URL must be same (or same domain at least) as the one it's being called from
    • ...and should be https (definitely mixed on this)
    • The %s is required. Whatever goes into the STUFF part of <a href="web+safarita:STUFF"> will be applied to the %. Not sure it's useful to us but it is required.
  3. The app to open it in (???). I'm not sure if it's Google or Chrome, or if this is even the way to do it in the first place.

navigator.registerProtocolHandler(
'web+chromer',
'https://pr-33.d3pqoo7mq9yhwf.amplifyapp.com/?orig=%s',
'Chrome'
);
navigator.registerProtocolHandler(
'web+googchrome',
'https://pr-33.d3pqoo7mq9yhwf.amplifyapp.com/?tester=%s',
'Google Chrome'
);
// debugger;
}, []);

const handleClose = () => {
setOpen(false);
history.push('/');
Expand All @@ -35,6 +54,23 @@ export const UnsupportedBrowserMsg: FC = () => {
<Typography align="center" gutterBottom variant="h4">
Unsupported Browser
</Typography>
<ul>
<li>
<a href="web+safarita:ok" target="_blank">
Safari
</a>
</li>
<li>
<a href="web+chromer:ok" target="_blank">
Chrome
</a>
</li>
<li>
<a href="web+googchrome:ok" target="_blank">
Google Chrome
</a>
</li>
</ul>
<p>
To submit your report, please open this site in a supported browser
such as Safari or Google Chrome.
Expand Down