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

Catching when "README.md" does not exist #4

Open
TedThompson opened this issue May 7, 2021 · 0 comments
Open

Catching when "README.md" does not exist #4

TedThompson opened this issue May 7, 2021 · 0 comments

Comments

@TedThompson
Copy link

TedThompson commented May 7, 2021

var xhr = new XMLHttpRequest();
xhr.onloadedend = function () {
    if(xhr.status == 404) return;
    }
xhr.onreadystatechange = function () {

First and last lines already exist - I inserted this function. I am using your "index.html" renamed as the src for an IFRAME in my index.html. It's a header for the index in every folder on my site, and will display the Readme.md as a MOTD - but I needed to avoid a 404 error if there was no Readme.md.

I also added

	<script>
	  var path = document.referrer;
	  var motd = "Readme.md";
	  var file = path.concat(motd);
	</script>

to your original HTML, so it looks for the Readme.md in the same directory as the parent page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant