ChimichangaCop
ChimichangaCop
KPCKevin Powell - Community
Created by ChimichangaCop on 9/10/2023 in #front-end
XHR "error" event listener not working when URL is wrong. Confused as to why
Working through Colt Steele's JavaScript course, and learning about XHR. This snippet is supposed to throw an error when the URL isn't correct. If I type gibberish like /planetiuhnuoidhfugn/ it still works/I'm not seeing an error in Chrome DevTools. It'll throw the error if I change "swapi" to "swap" or "dev" to "co" as "swapi.co" no longer exists:
const firstReq = new XMLHttpRequest();
firstReq.addEventListener("load", function () {
console.log("IT WORKED!!!");
});
firstReq.addEventListener("error", () => {
console.log("ERROR!!!!!!");
});
firstReq.open("GET", "https://swapi.dev/api/planets/");
firstReq.send();
console.log("Request Sent!");
const firstReq = new XMLHttpRequest();
firstReq.addEventListener("load", function () {
console.log("IT WORKED!!!");
});
firstReq.addEventListener("error", () => {
console.log("ERROR!!!!!!");
});
firstReq.open("GET", "https://swapi.dev/api/planets/");
firstReq.send();
console.log("Request Sent!");
8 replies
KPCKevin Powell - Community
Created by ChimichangaCop on 8/14/2023 in #front-end
Is fluid/responsive typography a good idea, or horrible for accessibility?
A few times now I've used calc() in my CSS to create semi-responsive typography on pages. In particular, I've used this formula from CSS Tricks: font-size: calc([minimum size] + ([maximum size] - [minimum size]) * ((100vw - [minimum viewport width]) / ([maximum viewport width] - [minimum viewport width]))); My use cases have been homepage heroes and CTAs (hybrids between buttons and cards - icons with text). Is this good practice in the name of responsiveness, or does it negatively impact accessibility? Should I be setting specific font-sizes through media queries instead? Thanks for any input on this πŸ™‚ πŸ‘
13 replies
KPCKevin Powell - Community
Created by ChimichangaCop on 8/8/2023 in #resources
Colormind - AI color palette generator
Thought this was neat - has one for websites, too, and suggests how to use the colors which is helpful. There’s a couple other tools listed on the homepage that are similar: http://colormind.io - http://colormind.io/bootstrap/
2 replies