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

Fails on Mobile Browsers #244

Closed
MikeGriffinReborn opened this issue Sep 5, 2024 · 3 comments
Closed

Fails on Mobile Browsers #244

MikeGriffinReborn opened this issue Sep 5, 2024 · 3 comments
Labels

Comments

@MikeGriffinReborn
Copy link

Fails on a lot of the older browser such as IPad 9th generation, iPhone 11's and so forth, all still good devices, in fact the iPad 9th is still a top seller, anyway, this is the error you get:

TypeError: o.canParse is not a function. (In 'o.canParse(r)', 'o.canParse' is undefined)

jQuery.Deferred exception: o.canParse is not a function. (In 'o.canParse(r)', 'o.canParse' is undefined) @https://whiskeyniner.com/js/wretch.all.min.js:1:5331 <= HERE !!!
l@https://whiskeyniner.com/js/wretch.all.min.js:1:1296

@https://whiskeyniner.com/js/w9/main-map.min.js:1:10540
e@https://whiskeyniner.com/js/JQuery.js:2:32975
@https://whiskeyniner.com/js/JQuery.js:2:33347 undefined
JQuery.js:3 TypeError: o.canParse is not a function. (In 'o.canParse(r)', 'o.canParse' is undefined)
(anonymous) @ JQuery.js:3

@MikeGriffinReborn
Copy link
Author

I fixed it by un-minifying the code (I cannot find un-minified versions anywhere - ?) so the code isn't pretty, but basically I did this:

// BEFORE
const makeBasicAuthMiddleware: (config: Config) => ConfiguredMiddleware = config => next => (url, opts) => {
const _URL = config.polyfill("URL")
const parsedUrl = _URL.canParse(url) ? new _URL(url) : null

// AFTER (I don't call "canParse")
const makeBasicAuthMiddleware: (config: Config) => ConfiguredMiddleware = config => next => (url, opts) => {
const _URL = config.polyfill("URL")
const parsedUrl = null // HERE HERE !! - I just set it to null because I don't use makeBasicAuthMiddleware() at all in my code

@MikeGriffinReborn
Copy link
Author

PS: I used BrowserStack.com to run it on live devices in order to debug this as it's very difficult to debug on mobile browsers as you probably know, anyway, thanks for a great library, there was no way I was giving it up.

@elbywan elbywan added the bug label Sep 6, 2024
@elbywan
Copy link
Owner

elbywan commented Sep 6, 2024

Hey @MikeGriffinReborn, thanks for reporting the issue!

I'll replace the URL.canParse call with a good old try/catch block.

@elbywan elbywan closed this as completed in f6fc851 Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants