Rok
Posts: 0
Joined: Wed Oct 09, 2013 7:48 am

Open URL from local storage within app or in default browser

Hi there,

i've tried a number of suggested sollutions found on this forum, however I cannot get to this thing to work.

Here is the deal.

I have a barcode service, used for scanning QR codes. It all works fine, the code is scanned, the url opens, however, i miss controls to navigate back to the app or to close browser.

Now, after scan is done, url opens and i have to restart the app to get to the first page again.

So what i am asking you is how to open URL(passed from barcode service) stored in local storage within app or in default browser. Either works for me.

BTW, i added javascript: window.location.href = localStorage.getItem('QR_url');

on barcode success. It opens normally, but without any controls.

Thanks in advance!

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Open URL from local storage within app or in default browser

Hello! Please try this way prewindow.open(url, '_blank');/pre where url - link you need to open

Rok
Posts: 0
Joined: Wed Oct 09, 2013 7:48 am

Open URL from local storage within app or in default browser

Hello Marina, thanks for your advice, however, url is not always the same url. Url is read from Barcode/QR code and it is always different. When barcode is scanned, url from barcode/QR code is stored in local storage and opened right afterwards.

So if i have local storage variable called QR_url, the javascript below would do the work?

window.open('QR_url', '_blank');

Thans, Rok

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Open URL from local storage within app or in default browser

Hi Rok,

If you store 'QR_url' variable in localStorage, then you can use the following code:prewindow.open(localStorage.getItem('QR_url'), '_blank');/pre

Rok
Posts: 0
Joined: Wed Oct 09, 2013 7:48 am

Open URL from local storage within app or in default browser

Hi Katya thanks for your reply.

I tried with your code and nothing happens after the scan. Then i replaced your code with my from the first post and it opens normally. Still without controls, of course.

I tested on iPhone 4, iOS7.

Any other suggestion?

Thanks, Rok

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Open URL from local storage within app or in default browser

Could you give us your public app link so we can test it on different devices? Perhaps the problem is with iOS7 as it's not officially supported yet.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Open URL from local storage within app or in default browser

Thank you! We'll test it, but it takes time.

Rok
Posts: 0
Joined: Wed Oct 09, 2013 7:48 am

Open URL from local storage within app or in default browser

Hi, ok, thanks, now there is a version with this code active:

window.open(localStorage.getItem('QR_url'), '_blank');

Return to “Issues”