'Backslashes or pipelines in url cordova
I am having trouble opening a url in an InAppBrowser on Cordova.
I have the following code:
if (device.platform.toUpperCase() === 'IOS'){
let url = "http://192.168.1.115:5000/Home/GetQRCode?value=" + value;
url = url.replace(/\\/g, '|');
alert(url);
ref = window.open(url, '_system', inAppBrowserOptions);
}
I thought the url couldn't have backslashes on iOS urls so I replaced them with pipelines. That didn't work either.
After I read the QRCode the app stays still meaning it doesn't open the page and it remains on my index page where I have the splashscreen.
How do I solve this problem?
Solution 1:[1]
Pipes and backslashes are not supported/valid in URLs, besides you should encode your URLs (or your Query Strings) using
encodeURIComponent()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Eric |
