Coder Social home page Coder Social logo

Comments (9)

jeremyckahn avatar jeremyckahn commented on June 8, 2024

This is working better, but GitHub Pages environments still don't work with room links in WebKit browsers. They result in broken room URLs like the one here: #167 (comment)

The code here needs to be revisited to address this:

// See: https://github.com/rafgraph/spa-github-pages/blob/gh-pages/404.html
// Single Page Apps for GitHub Pages
// MIT License
// https://github.com/rafgraph/spa-github-pages
// This script takes the current url and converts the path and query
// string into just a query string, and then redirects the browser
// to the new url with only a query string and hash fragment,
// e.g. https://www.foo.tld/one/two?a=b&c=d#qwe, becomes
// https://www.foo.tld/?/one/two&a=b~and~c=d#qwe
// Note: this 404.html file must be at least 512 bytes for it to work
// with Internet Explorer (it is currently > 512 bytes)
// If you're creating a Project Pages site and NOT using a custom domain,
// then set pathSegmentsToKeep to 1 (enterprise users may need to set it to > 1).
// This way the code will only replace the route part of the path, and not
// the real directory in which the app resides, for example:
// https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes
// https://username.github.io/repo-name/?/one/two&a=b~and~c=d#qwe
// Otherwise, leave pathSegmentsToKeep as 0.
var pathSegmentsToKeep = 0
var l = window.location
l.replace(
l.protocol +
'//' +
l.hostname +
(l.port ? ':' + l.port : '') +
l.pathname
.split('/')
.slice(0, 1 + pathSegmentsToKeep)
.join('/') +
'/?/' +
l.pathname
.slice(1)
.split('/')
.slice(pathSegmentsToKeep)
.join('/')
.replace(/&/g, '~and~') +
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
)

from chitchatter.

ralphshinevar avatar ralphshinevar commented on June 8, 2024

I am not a javascript expert by any means. I was looking at some 404.html examples and this is different than yours:

Yours: var pathSegmentsToKeep = 0

Another: var pathSegmentsToKeep = 1;

What does the 1 over 0 do? Do you need a semi-colon? ;

from chitchatter.

ralphshinevar avatar ralphshinevar commented on June 8, 2024

Adding the ; var pathSegmentsToKeep = 0; does not change the outcome.

from chitchatter.

ralphshinevar avatar ralphshinevar commented on June 8, 2024

// If you're creating a Project Pages site and NOT using a custom domain,
// then set pathSegmentsToKeep to 1 (enterprise users may need to set it to > 1).

Are we using a custom domain? If not change to "l"?

from chitchatter.

jeremyckahn avatar jeremyckahn commented on June 8, 2024

@ralphshinevar if you'd like try an immediate fix for your fork, try changing this line: https://github.com/ralphshinevar/chitchatter/blob/e63632c0c3827980f8e8d62726ab8e30c7f8789a/public/404.html#L27

Change the 0 to 1 and commit the file (in your main branch). That should trigger a new deployment.

from chitchatter.

ralphshinevar avatar ralphshinevar commented on June 8, 2024

Jeremy. The change to 1 apparently works. I was able to get in from my laptop and my phone! How about that? I fixed the javascript. I always say "necessity is the mother of invention."

from chitchatter.

ralphshinevar avatar ralphshinevar commented on June 8, 2024

Let's see if my testers (friends) can get in.

from chitchatter.

ralphshinevar avatar ralphshinevar commented on June 8, 2024

They seem to be busy. I guess I will go and mow the lawn. Try them later.

from chitchatter.

jeremyckahn avatar jeremyckahn commented on June 8, 2024

@ralphshinevar this should now be fully fixed. Try syncing your main branch with mine to get up to date.

from chitchatter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.