Http get not working on mobile

I’m using http get to receive data back(json), this is working good in ionic serve, but doesn’t work on mobile(android), my data and session variables turn up null which means I can’t get any data.

In chrome usb debugging iget the following Failed to load resource: net::ERR_NAME_NOT_RESOLVED

I’ve tried this every which way and can’t seem to get anywhere, help would be appreciated. can’t post any code


That’s really frustrating for anybody trying to help you, and comes across as selfish. Perhaps you have a hostname hardcoded into your app that isn’t reachable from your device. If you’re not willing to share any code, that’s all I can be bothered to say.

1 Like

Sorry what I meant was I cant post the code as is, I’m going to have to modify it which I will do asap. Appreciate the response

    "use strict";

    const VERSION  = "3.0" // 2.43
    const session = localStorage.getItem('session'); // this gets session id
    const MAINLINK = BASELINK + "&job=Search&session="+session;

I don’t think it would be relevant. I moved the topic to the v1 category, because it looks like v1 code.

I do fear, however, that you may have elided the problem away in your redaction for posting. As you have written it here, the url you are attempting to reach seems like it would look something like “LINK3.0&job=Search&session=abc123”. That’s not a valid URL: it’s missing a protocol and host at the beginning, which is where I suspect the problem lies.

“localhost” as a host name is particularly problematic and prone to causing symptoms such as the one you describe, as well as having devices and development machines on different networks. So my advice is to concentrate on the hostname part of the URL (which I’m not seeing here). The problem as you describe it is that the device is not properly resolving that hostname.

Sorry the link is more like this “http://website.test/Start?mobile=1&version=” i just redacted everything to LINK, i’m not sure if that changes anything tho

I would try installing a utility such as DNS Lookup on your device and seeing if it can resolve whatever “website.test” really is. I get that you seem to feel like stuff like hostnames is personal and you don’t want to post it publicly, but from the error you have provided it really seems like that’s where the problem lies.

Hmm I really don’t think it would be a dns problem these links have been tested before, i’ll still have a look at it tho, I was thinking more along the lines of localStorage possibly not working on mobile devices because it doesn’t get the session variable saved where as on the browser it works just fine, thoughts?

I was able to get the session id part working, and it worked once on mobile, but now it still doesn’t want to work anymore, http requests are still pending and then failing after about 2 minutes, I don’t understand why it would work and then just not work like that, any clues/ideas?

Sorry, but I’m still fixated on DNS, because that’s what causes the error in your OP.

What do I need to check with dns lookup?

Issue has been resolved appreciate the help!