Hi.
We build Hosted Web App, it's app for social network and have many external links in user posts.
As well, links between pages inside our App use some different subdomains and one external site for counting statistics with back-redirect into our App..
We wanna open all user external links in browser, but "our external" links in App.
List of domains for example:
- http://main.com
- https://auth.main.com
- http://video.main.com
- http://stat.com/counter123/back/redirect/url
I try to use code like this:
$(window).on("click", "a", function (e) { var rbPattern, appControl; // Pattern for statistik link with back-redir rbPattern = new RegExp("^http://stat.com/[a-z]+[0-9]+/domain.com"); if (e.target.host !== 'domain.com' && !rbPattern.test(e.target.href)) { try { appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view", e.target.href); tizen.application.launchAppControl( appControl, null, function () { console.log("Browser opened"); }, function (e) { App.Share.notify("Browser error: " + e.message); } ); } catch (e) { alert(e.name + ': ' + e.message); } e.stopPropagation(); e.preventDefault(); } });
But catch error "ReferenceError: Can't find variable: tizen".