Start a new topic

A “back” button in the site header

This may seem silly (after all, you can use the “back” button on your browser, right?) but if you run Cohost as a web app on something like an iPad (by adding a shortcut to it to your Home Screen and launching it from there), the standard Safari controls aren’t present.

I can just view Cohost as a Safari tab, of course, but it’s nice to have it run as its own app, without the Safari UI clutter.


4 people like this idea

Yes!! I was considering posting this. The swiping back mostly works but it's not as responsive as swiping on a native app often is. A back button would be very welcome.

I just implemented a very basic back button myself.  If you install the Tampermonkey extension, you can use this script to put in the back button (and also set theme color)

// ==UserScript==

// @name Cohost PWA stuff

// @namespace https://cohost.org/

// @version 0.1

// @description try to take over the world!

// @author You

// @match https://cohost.org/*

// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==

// @grant none

// ==/UserScript==

(function() {

    'use strict';

    document.addEventListener('DOMContentLoaded', function(){

        var a = document.createElement('div');

        a.innerHTML = '<a class="text-text hover:text-accent" onclick="window.history.back()" style="font-weight: 900;">&lt; back</a>';

        document.querySelector("a[href='https://cohost.org/']").parentNode.prepend(a);

        console.log("cohost");

        document.querySelector("header").style="padding-left: 1em; padding-right: 1em;";

        var meta = document.createElement('meta');

        meta.name = "theme-color";

        meta.content = "#83254f";

        document.querySelector("head").append(meta);

    })

})();

image


 

 

 

Thanks! Unfortunately I usually browse on my iPad, but I’m sure this will be helpful for those browsing on their desktops.


1 person likes this

Yeah the whole reason I would want it is mobile, on firefox on desktop I have a back button so it's wholly unnecessary. It's cool that you made it work, though!

I use cohost as a PWA on both mobile and desktop.

I didn't know about the swipe-to-go-back gesture, so when I first tried the progressive web app I didn't even think it was possible to go back. Even knowing about the gesture, I would prefer a button.

Login or Signup to post a comment