i’m making my weather app and have pretty much done. I did a little broiwser testing and in the browsers mentioned it doesnt work because of a js error -
: Unable to get property ‘1’ of undefined or null reference, it is refering to line 134 in the js.
Opera gives me nothing in the console, I found the error only in ms browsers.
Something is going wrong when convertTime is called with getTime. For some reason it’s not finding a match with the regex and thus returning null. I hard coded a string for getTime and it works. Using your current implementation of getTime fails.
The .replace() method did have an effect but it the error just moved a couple of lines down and the app hung again in ie.
I went and read your link again and googled a bit more.
In the comments of your link I found that toLocaleTimeString should only be used for human representations of strings and to use other methods if you intend the time to be used by the machine.
so I changed this:
var getTimeNow = new Date(new Date().getTime()).toLocaleTimeString(‘en-uk’, {
hour: ‘numeric’,
minute: ‘numeric’
});
to this:
var getTimeNow = new Date(new Date().getTime()).toTimeString(‘en-uk’, {
hour: ‘numeric’,
minute: ‘numeric’
});
and hey presto, ie11 then became the fast performing browser of opera, firefox, edge, chrome and ie.
So, thank you sir for putting me on the right track.
Mark
On a side note, maybe for another thread/time:
ie being fast made alarm bells ring because a) ie being fastest should not happen, and b) I kinda hoped the performance trouble I was having was down to this error.
So as a bit of pleniminary diagnosis I just disabled my geo feature & error checking function to skip directly to the fetch function and the performance issues go away… good job i’m enjoying these issues eh?
EDIT:
I also fixed the performance issue. I was calling geolocate again when i didnt have too. Its been a fine morning of novice bug squashing!