Emanuele Gurini
@EmanueleGuriniAll comments
- @ElenaAnnibaliSubmitted about 2 years ago@EmanueleGuriniPosted about 2 years ago
Elena, pay attection on Firefox because some browsers caching the data from a specific server, and in this case Firefox detects that you are sending the request to same end-point, and he try to give you back the data in a faster way sending back the data that your already got before.
As you know, when you work with HTTP methods you can set many info inside your request (https://developer.mozilla.org/en-US/docs/Web/API/Request/cache), so in that case you need to tell to your browser that you don't want to cache the data: fetch(url, { cache: "reload" })
0 - @lidiakrajewskaSubmitted about 2 years ago
Hi! My solution works fine on Google Chrome, but in Firefox I keep getting the same advice all the time. What can be the cause of it?
@EmanueleGuriniPosted about 2 years agoSome browsers caching the data from a specific server, and in this case Firefox detects that you are sending the request to same end-point, and he try to give you back the data in a faster way sending back the data that your already got before.
As you know, when you work with HTTP methods you can set many info inside your request (https://developer.mozilla.org/en-US/docs/Web/API/Request/cache), so in that case you need to tell to your browser that you don't want to cache the data: fetch(url, { cache: "reload" })
Marked as helpful1 - @mattyoung7Submitted over 2 years ago
Spent a couple of months learning the basics of Javascript, APIs etc. and attempted this based on what I've learned. If there's a quicker or better way to do this, please let me know!
@EmanueleGuriniPosted over 2 years agoHi @mattyoung7, well done, but reload doesn't works on FireFox: seem that FF caching the fetch result.
I found this solution on StackOverflow (https://stackoverflow.com/questions/72567690/ui-is-not-updating-on-click-event-that-triggers-a-fetch-on-firefox-developer) but the problem is that property called count is always incremented by one, and, if you start a new session, advice is always the same in a row.
To avoid the same advice in a row, as you can see from my solution, I create a new Random number, and I use it only if my script detects firefox browser.
My solution: https://github.com/EmanueleGurini/js-advicegenerator/blob/master/js/main.js
ps. why am I using 224 as max number? Advices are 224.
0 - @eyedent1tySubmitted over 2 years ago@EmanueleGuriniPosted over 2 years ago
Hi Mirai, well done, but reload doesn't works on FireFox: seem that FF caching the fetch result.
I found this solution on StackOverflow (https://stackoverflow.com/questions/72567690/ui-is-not-updating-on-click-event-that-triggers-a-fetch-on-firefox-developer) but the problem is that property called count is always incremented by one, and, if you start a new session, advice is always the same in a row.
To avoid the same advice in a row, as you can see from my solution, I create a new Random number, and I use it only if my script detects firefox browser.
My solution: https://github.com/EmanueleGurini/js-advicegenerator/blob/master/js/main.js
ps. why am I using 224 as max number? Advices are 224. Ema
Marked as helpful0 - @Gareth-MooreSubmitted over 2 years ago
So this wasn't very difficult. But I'd love to know what you think of the API process I used and any advice regarding the JS/API.
Also... this website works perfectly in Chrome, but in Firefox it returns the same advice even if I close and reopen the browser. It's a bit odd and almost impossible to find any solutions to fix it. If you do know, I'd love to hear about it.
Thanks, Gareth
@EmanueleGuriniPosted over 2 years agoHi Gareth, seems that Firefox is caching the fetch result. I found this solution on StackOverflow (https://stackoverflow.com/questions/72567690/ui-is-not-updating-on-click-event-that-triggers-a-fetch-on-firefox-developer) but the problem is that property called count is always incremented by one, and, if you start a new session, advice is always the same in a row.
To avoid the same advice in a row, as you can see from my solution, I create a new Random number, and I use it only if my script detects firefox browser.
My solution: https://github.com/EmanueleGurini/js-advicegenerator/blob/master/js/main.js
ps. why am I using 224 as max number? Advices are 224.
Marked as helpful0 - @f3anSubmitted over 2 years ago@EmanueleGuriniPosted over 2 years ago
Hi Ihor, I was checking your solution and I think that is well done. Btw, when you search a user that does not exist and try to change color theme, there are some problem with the middle box: does not update color.
Emanuele
Marked as helpful1 - @dokkalemonSubmitted almost 3 years ago@EmanueleGuriniPosted almost 3 years ago
Great job, dokkalemon, i like how you solved the challenge: very close to the original design.
Marked as helpful0