How to Alert and Redirect users to Mobile App

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MikesSite
    Senior Member
    • Jan 2009
    • 173
    • 3.8.x

    #16
    I can't use this, it asks every time a new window is open. This should be put in a cookie and should only pop up once like tapatalk.

    Comment

    • Samhayne-STS
      New Member
      • May 2011
      • 11
      • 4.1.x

      #17
      Originally posted by MikesSite
      I can't use this, it asks every time a new window is open. This should be put in a cookie and should only pop up once like tapatalk.
      I agree that a one time pop up, or allowing the user to select to not display the pop up in the future would be optimal.

      However, if you don't reload the full forum all the time (by using the back button, for example) the notification doesn't pop up for me and I find it ok.

      Comment

      • ikaro
        New Member
        • Mar 2010
        • 25
        • 4.0.0

        #18
        Great! It is exactly what I was looking for

        Great job!

        Dan

        Comment

        • af1racing
          Member
          • Jul 2006
          • 64

          #19
          This adds a cookie so it only pops up once per session:

          Header:

          Code:
          <body onload="loadornot();">
          Headinclude:

          Code:
          <script type="text/javascript">
          
          function get_cookie(Name) {
            var search = Name + "="
            var returnvalue = "";
            if (document.cookie.length > 0) {
              offset = document.cookie.indexOf(search)
              if (offset != -1) { // if cookie exists
                offset += search.length
                // set index of beginning of value
                end = document.cookie.indexOf(";", offset);
                // set index of end of cookie value
                if (end == -1)
                   end = document.cookie.length;
                returnvalue=unescape(document.cookie.substring(offset, end))
                }
             }
            return returnvalue;
          }
          
          function loadornot()
          {
          if (get_cookie('popup')=='')
          {
          iPhoneAlert( )
          document.cookie="popup=yes"
          }
          }
          
          
          
          function iPhoneAlert( )
          {
          if ( navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) )
          {
          var qes   = confirm( "This forum has an iPhone app! Click OK to learn more about ________ for iPhone." );
          if ( qes )
          window.location   = "http://________";
          }
          else if ( navigator.userAgent.match(/Android/i) )
          {
          var qes   = confirm( "This forum has an Android app! Click OK to learn more about ________ for Android." );
          if ( qes )
          window.location   = "https://_______";
          }
          }
          </script>

          Comment

          • worried
            Senior Member
            • Dec 2008
            • 684
            • 4.2.X

            #20
            Thanks for the cookie.

            Comment

            • Huskermax
              Senior Member
              • Mar 2010
              • 622
              • 4.2.X

              #21
              Originally posted by SteveLV702

              ***UPDATED July 7, 2012*** With the future release of iOS 6 this Fall you can add "SmartApp Banners" to your site example running on my sites below.

              [ATTACH=CONFIG]60408[/ATTACH][ATTACH=CONFIG]60409[/ATTACH][ATTACH=CONFIG]60410[/ATTACH][ATTACH=CONFIG]60411[/ATTACH][ATTACH=CONFIG]60412[/ATTACH]

              To acquire this on your site just add one simple line of code I added it to the very very top of the headerinclude template

              <meta name="apple-itunes-app" content="app-id=XXXXXXXX">

              Replace the XXXXXXXXX with your apps actual App ID.
              I did this and it works great! Thanks. I will try the other one later.

              - - - Updated - - -

              Originally posted by af1racing
              This adds a cookie so it only pops up once per session:

              Header:

              Code:
              <body onload="loadornot();">
              Headinclude:

              Code:
              <script type="text/javascript">
              
              function get_cookie(Name) {
                var search = Name + "="
                var returnvalue = "";
                if (document.cookie.length > 0) {
                  offset = document.cookie.indexOf(search)
                  if (offset != -1) { // if cookie exists
                    offset += search.length
                    // set index of beginning of value
                    end = document.cookie.indexOf(";", offset);
                    // set index of end of cookie value
                    if (end == -1)
                       end = document.cookie.length;
                    returnvalue=unescape(document.cookie.substring(offset, end))
                    }
                 }
                return returnvalue;
              }
              
              function loadornot()
              {
              if (get_cookie('popup')=='')
              {
              iPhoneAlert( )
              document.cookie="popup=yes"
              }
              }
              
              
              
              function iPhoneAlert( )
              {
              if ( navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) )
              {
              var qes   = confirm( "This forum has an iPhone app! Click OK to learn more about ________ for iPhone." );
              if ( qes )
              window.location   = "http://________";
              }
              else if ( navigator.userAgent.match(/Android/i) )
              {
              var qes   = confirm( "This forum has an Android app! Click OK to learn more about ________ for Android." );
              if ( qes )
              window.location   = "https://_______";
              }
              }
              </script>
              Works!

              Comment

              • PhiHDN
                New Member
                • Aug 2012
                • 3
                • 4.2.X

                #22
                In iOS 6, if I use both java-script and meta tag, will it show 2 duplicate bar?
                We need use both for iOS 6 and previous iOS ver. Right?

                - - - Updated - - -

                Anyone have screenshot of this script?

                Comment

                • Vibhor
                  Senior Member
                  • Jun 2009
                  • 200

                  #23
                  Hi. What would be the code if I want to show a pop-up only to Android users?

                  Thanks!

                  Comment

                  • Merenguista
                    Senior Member
                    • Jul 2010
                    • 555
                    • 5.3.x

                    #24
                    I cant find headinclude template on my vB 5 ..

                    Comment

                    • Huskermax
                      Senior Member
                      • Mar 2010
                      • 622
                      • 4.2.X

                      #25
                      Originally posted by Merenguista
                      I cant find headinclude template on my vB 5 ..
                      I think this code is just for 4.X, not sure Steve has done anything for VB5

                      Comment


                      • Merenguista
                        Merenguista commented
                        Editing a comment
                        Thanks .. Alas !
                    • Cristi_XP
                      Member
                      • Dec 2007
                      • 88
                      • 3.6.x

                      #26
                      Does anyone use something like this for vb5? Or knows how to implement it there? Thanks!

                      L.E. it works for me in vb5... the headerinclude template is header-include in vb5. Have manage to see it work on android...
                      Last edited by Cristi_XP; Thu 31 Oct '19, 4:37am.

                      Comment

                      • Mark.B
                        vBulletin Support
                        • Feb 2004
                        • 24287
                        • 6.0.X

                        #27
                        This thread is nearly nine years old. A *lot* has changed in that time, so it would be better to start a new thread with full details of the issue.
                        MARK.B
                        vBulletin Support
                        ------------
                        My Unofficial vBulletin 6.0.0 Demo: https://www.talknewsuk.com
                        My Unofficial vBulletin Cloud Demo: https://www.adminammo.com

                        Comment

                        • Cristi_XP
                          Member
                          • Dec 2007
                          • 88
                          • 3.6.x

                          #28
                          Yes, but it works also in vb5 also, so I confirmed to anyone want to use this.

                          Comment

                          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                          Working...