0

I'm trying to start up my app in Android browser. If the method start() is invoked by timer, the broken link appears. If the button is pressed, start() will run the app. Please, could you help me.

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>Test page</title>
  </head>
  <body>
        <button onclick="start()">Button</button>
  <script>
      setTimeout(function() {
          start();
      }, 3000);
      function start() {
          window.open("http://com.xxx/xxx-services/user/reset-password/12345", "_self")
      }
  </script>
  </body>
</html>
icedwater
  • 4,701
  • 3
  • 35
  • 50
DraganS
  • 2,621
  • 1
  • 27
  • 40
  • The question is unclear. Do you want to start your app when user navigate to one of the page on your site? If yes, why do you need to do it with JavaScript by Timer instead of http redirect? – Sergey Yamshchikov Mar 12 '15 at 12:58
  • The idea is to open my app when user click some link in email (for example to change forgotten password). Since the app is Cordova (sencha touch app) the idea is to redirect to an external url which should determine the device (ios/android) and then to start up my app. – DraganS Mar 12 '15 at 14:19
  • So, your case is something like this: 1. User received email from your site with link 2. User click on the link 3. User's browser navigate to your site 4. Your site determine OS of the device 5. Your site redirect the user to particular URL Is it correct? – Sergey Yamshchikov Mar 12 '15 at 14:25
  • Yes. That's the case. We've even created test page. When the page is open in the native android browser the start() method doesn't start up app. If the button "button" is clicked, start() method opens the app – DraganS Mar 12 '15 at 14:28
  • I can't check it right now, but I suppose it's due to security purpose. Why don't you just send redirect (HTTP 302) with particular URL to the client instead of html page? – Sergey Yamshchikov Mar 12 '15 at 14:31

0 Answers0