We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    I am facing a rather simple problem : I am building a website which (per the client requirements) has a flash intro, and I don’t want users having to skip intro each time. The thought was, let’s set a cookie to do just that. I googled this and curiously discovered resources are scarce (or else, I did not formulate my request good enough).

    But basically, three methods exist :
    - the SharedObject method : http://www.quip.net/blog/2006/flash/actionscript-20/persistent-data-shared-object
    - the javascript method : http://roselli.org/adrian/articles/splash_skip.asp
    - the php method

    Which one of those are you using / would you use ?

    Thanks smiley
      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 16429
      • 254 Posts
      Using TemplateSwitcher, use 2 templates for the home page, one with full content and one with the intro flash. Set the cookie of TemplateSwitcher at the end of the intro and on "Skip Intro" so the user will never see the intro again, because it switches to the full home template when he returns.
        kudo
        www.kudolink.com - webdesign (surprised?)

        [img]http://www.kudolink.com/kudolinkcom.png[/img] [sup]proudly uses[/sup] [img]http://www.kudolink.com/modx.png[/img]
        • 6726
        • 7,075 Posts
        Very smart and elegant kudolink, I wouldn’t have thought of that !
        I guess this could be moved to the tips and tricks forum smiley
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l'outil id
          • 6726
          • 7,075 Posts
          Update : I have discussed with kudolink, since I didn’t understand how to do what he describes. So that everyone can benefit from it, here are the instructions :

          Drawbacks of this method: your home page cannot be cached, due to TemplateSwitcher plugin requirements.

          Design 2 homepage templates.

          One will contain NOT the home page [*content*] or TVs, but the flash intro. This is the Template you’ve to assign to your home page in the manager. Let’s say "FlashHomeTemplate".
          Now you have an home page that shows your flash intro.

          Ok, now the second template. Obviously the second template will be the very home page one. Let’s call this "HomeTemplate".

          Install TemplateSwitcher with cookies ON. Now, 2 things to do on the FlashHomeTemplate: the first is to create a "Skip Intro" link to the same page, but with "?template=HomeTemplate" added to the url. If you don’t use FUrls can add simply "&template=HomeTemplate".
          The second thing you’ve to do is add a redirect at the end of the Flash to the same link (a link to the page itself with "?template=HomeTemplate" or &template=HomeTemplate).

          The TemplateSwitcher will set a cookie in the user pc when he switch from a template to another: so, in this case, it will set a cookie when:

          * A user clicks to "skip intro";
          * A user sees the Flash until the end.

          When a user with a cookie set returns to the home page the TemplateSwitcher will change template to the HomeTemplate, and he will see the true home page and not the Flash intro Smiley

          Remember, the home page has to be NOT cached to recognize when a user has the cookie set.
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id
            • 22815
            • 1,097 Posts
            Similarly, a link to "View Intro" can be added to all pages. Your client will want to be able to see that again after their first visit to show it to people, and people may want to see it again.
              No, I don't know what OpenGeek's saying half the time either.
              MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
              Forum: Where to post threads about add-ons | Forum Rules
              Like MODx? donate (and/or share your resources)
              Like me? See my Amazon wishlist
              MODx "Most Promising CMS" - so appropriate!
              • 16429
              • 254 Posts
              @PaulGregory: right, good.

              @davidm: you didn’t tell me if it works smiley
                kudo
                www.kudolink.com - webdesign (surprised?)

                [img]http://www.kudolink.com/kudolinkcom.png[/img] [sup]proudly uses[/sup] [img]http://www.kudolink.com/modx.png[/img]
                • 6726
                • 7,075 Posts
                @Paul : yeah, you’re right, especially if you consider how hooked on "flash show off" executives are tongue

                @kudolink: Sorry, I just posted something about that on the TemplateSwitcher thread... it works alright, but not the way I would have thought it would...
                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l'outil id
                  • 31227
                  • 198 Posts
                  Ive attached a zip file with another method, javascript which attaches cookie after the intro, or another way is for the visitor to become a "frequent" visitor, after the 3 time he wont see the intro, but if he wants to, he need to click on a specific link and he will be able to see the intro.
                    Pure MODx sites
                    Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
                    • 6726
                    • 7,075 Posts
                    Thanks a lot Vait for this, I’ll give this a try and report smiley
                      .: COO - Commerce Guys - Community Driven Innovation :.


                      MODx est l'outil id
                      • 31227
                      • 198 Posts
                      Here is another js which I like, just save the following text into a *.js file, set the parameters and call it:) The only thing that it lacks is that no kill cookie way... I’ve tried but I didn’t succeed, of course there is another way just make a new file and let the visitors view it if they wish to view the intro...
                      /* This script and many more are available free online at
                      The JavaScript Source!! http://javascript.internet.com
                      Created by: William Bontrager | http://www.bontragerconnection.com/ */
                      // Copyright 2006 Bontrager Connection, LLC
                      // This version of the script redirects automatically.
                      // The Web site has a few other methods for directing also:
                      // http://www.bontragerconnection.com/library/redirect_with_a_cookie.shtml
                      
                      // Three items can be customized (values between quotation marks):
                      //
                      // 1. What URL shall the browser be redirected 
                      //    to if a cookie was previously set?
                      
                      var RedirectURL = "http://yourdomain.com";
                      
                      // 2. How many days shall the cookie live in 
                      //    the visitor's browser (0 means remove 
                      //    cookie whenever browser closes)?
                      
                      var DaysToLive = "0";
                      
                      // 3. What name shall the cookie have (any 
                      //    sequence of alphabetical characters 
                      //    is okay, so long as the name doesn't 
                      //    conflict with any other cookies that 
                      //    this web page might be setting.)?
                      
                      var CookieName = "NAME-HERE";
                      
                      // No other customization is required.
                      
                      function Action() {
                      location.href = RedirectURL;
                      }
                      
                      DaysToLive = parseInt(DaysToLive);
                      var Value = 'bypass page next time';
                      
                      function GetCookie() {
                      var cookiecontent = '';
                      if(document.cookie.length > 0) {
                         var cookiename = CookieName + '=';
                         var cookiebegin = document.cookie.indexOf(cookiename);
                         var cookieend = 0;
                         if(cookiebegin > -1) {
                            cookiebegin += cookiename.length;
                            cookieend = document.cookie.indexOf(";",cookiebegin);
                            if(cookieend < cookiebegin) { cookieend = document.cookie.length; }
                            cookiecontent = document.cookie.substring(cookiebegin,cookieend);
                            }
                         }
                      if(cookiecontent.length > 0) { return true; }
                      return false;
                      }
                      
                      function SetCookie() {
                      var exp = '';
                      if(DaysToLive > 0) {
                         var now = new Date();
                         then = now.getTime() + (DaysToLive * 24 * 60 * 60 * 1000);
                         now.setTime(then);
                         exp = '; expires=' + now.toGMTString();
                         }
                      document.cookie = CookieName + '=' + Value + exp;
                      return true;
                      }
                      
                      if(GetCookie() == true) { Action(); }
                      
                      SetCookie();
                      

                      Hope this helps
                        Pure MODx sites
                        Viriko.ru & Viriko.com - Multilingual and running on 1 MODx