Home > other >  Backslashes or pipelines in url cordova
Backslashes or pipelines in url cordova

Time:04-06

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?

CodePudding user response:

Pipes and backslashes are not supported/valid in URLs, besides you should encode your URLs (or your Query Strings) using

 encodeURIComponent()
  • Related