10 Replies Latest reply on Jul 27, 2011 6:27 AM by Mattr1981

    Can HTML wrapper use deep linking ?

    eprevot123 Level 2

      I use the generated html wrapper that loads the swf application, with SWFObject.embedSWF(myApplication.swf, ...)

      I plan to use deep linking to be able to access the application in a given state, with a url like myApplication.swf#/state1

       

      I would like to have another html wrapper that loads the application in that state.

      Can we do that ? Can I just copy the generated wrapper and only change SWFObject.embedSWF(myApplication.swf#/state1, ...) ?

        • 1. Re: Can HTML wrapper use deep linking ?
          Flex harUI Adobe Employee

          I'm not sure I understand.  If you are using BrowserManager, it pulls the

          information from the html page's URL, not the one in the embedSWF.

          • 2. Re: Can HTML wrapper use deep linking ?
            eprevot123 Level 2

            (I don't know if it's better to use BrowserManager or SWFAddress for deep linking)

             

            I want to create like a "landing page", an html page that loads my application in a given state, different from the generated html wrapper that loads the application in the starting state. I need to know what I have to do so that the html wrapper loads the swf application in a given state.

            • 3. Re: Can HTML wrapper use deep linking ?
              Mattr1981 Level 1

              The HTML Wrapper  auto generated by flex can use deep linking, the easiest way is to use http://www.asual.com/swfaddress . Add SWFAddress to your html- template in flex. Basically modify the index.template.html file in your project. Add this line  <script type="text/javascript" src="PATH_TO_SWFADDRESS"/> underneath where it declares SWFObject (MUST be underneath). Import the SWFAddress.swc file to your lib folder.

               

              Then do your in-flex code for handling deep linking, event listeners etc which I wont go into because it cant be told, it has to be learnt.

               

              Now, I have just re-read your post and realised that you just want a landing page. Just Clone your application. Have one swf start at the state you want and the other start at the state you want. Your choice but if you dont have to overcomplicate things, dont..

              • 4. Re: Can HTML wrapper use deep linking ?
                eprevot123 Level 2

                Indeed my problem is not how to use deeplinking in my flex application, but how to have html page that loads my flex application in a given state.

                I don't want to clone the flex application, it seems a bad solution to me to have as many swf as states in the application.

                 

                The problem under this is SEO : I want a full flash website that could be indexed by search engine. I read that deep linking alone does not help because search engines don't use javascript so they don't see what is after the # in the URL. So even if you use deep linking and you can access your application in the browser with myApplication.html#/state1, myApplication.html#/state2, myApplication.html#/state3, ... search engines only see one page : myApplication.html.

                A solution to this is to have one html page per state (with alternative content that can be read by search engines) and each html page loads the application in a specific state. So I want to create as many html pages as sections in my flex application so that SE index all sections of my application.

                Like www.cartier.com does for example.

                (I just start to get into SEO, tell me if I'm wrong)

                 

                I just thought I could set flashVars in each html wrapper according to the state I want to display, and in the starting application use the flashVar to know the state to go. Is it a good idea ?

                • 5. Re: Can HTML wrapper use deep linking ?
                  Mattr1981 Level 1

                  Go to

                   

                  http://www.jamoptical.co.uk/store/frames/10013/

                   

                  then close your browser and go to

                   

                  http://www.jamoptical.co.uk/store/#/frames/10013

                   

                   

                  Also try looking at both in firefox with Flash and JS support switched off.

                   

                  Is this what you kind of want ?

                  • 6. Re: Can HTML wrapper use deep linking ?
                    Mattr1981 Level 1

                    If you just want to have loads of html file that load your app in a certain state then you will need to use flashvars. Have a flashvar on each page called state.

                     

                    <param name="flashvars" value="state=state1" />

                    <param name="flashvars" value="state=state2" />

                    <param name="flashvars" value="state=state3" />

                     

                    Or use a bit of VB in the JS of an ASPX page

                     

                    <param name="flashvars" value="state=<%=Request.QueryString("state")%>" />

                     

                    and get it from the querystring

                     

                    then in your app get the flashvar

                     

                    var params:Object = FlexGlobals.topLevelApplication.parameters;

                     

                    var state:String= params.state

                     

                    Then have state changing logic based on the state value.

                     

                    Message was edited by: Mattr1981

                    • 7. Re: Can HTML wrapper use deep linking ?
                      eprevot123 Level 2

                      Yes, Jamoptical works exactly as I want.

                      (Is it common ? Or is there a more simple/efficient way to have flash website optimized for search engines ?)


                      So I will use flashvars then. Thank you!

                      • 8. Re: Can HTML wrapper use deep linking ?
                        Mattr1981 Level 1

                        There are a few ways to get your flex site into the search engines. Jam Optical has only been online for 9 days and I am already ranked 10 for "quality prescription glasses". I chose this keyword as a test to see if it is possible to get onto a good rank through natural search results. I'm currently goiing after some more keywords, but enough about that.

                         

                        I use a combination on urlrewrite on iis 7, a query paramater, swfobject, swfaddress, flashvars, and alternative content on the asp page.

                        The sitemap I submit to google contains the links in the form http://www.jamoptical.co.uk/store/frames/10043

                        this is essentially the url http://www.jamoptical.co.uk/store/page.aspx?param=10043 but google doesnt like  http://www.jamoptical.co.uk/store/#/frames/10043, it sees it as  http://www.jamoptical.co.uk/store/

                         

                        Using swfaddress and flashvars i first check the validity of the param (This is a MUST) when my application loads, that it exists and is valid. If both are true i set a desired state in my application in the code. While the Google robot CAN read small bits of info from my SWF, I also present alternate content that is EXACTLY shown as on my SWF. Otherwise it could be considered cloaking. The next trick is to then make sure that when the user leaves the page to go to the stores main page or to proceed with buying the item that swfaddress rewrites the url to a more swfaddress friendly format http://www.jamoptical.co.uk/store/#/catalogue for the main page or http://www.jamoptical.co.uk/store/#/purpose for the next page. The application data is in an arraycollection which is packaged/serialised up and stored in session so that when they move to the next page no data is lost (i.e. if they have something in the cart).

                         

                        This is so that once they have moved on, they can enjoy the benefits of swfaddress integration and browser back button use.

                         

                        It seems to work.

                         

                        I was going to write large article on this post it to my blog but I dont quite have the time at the moment. I truly believe RIA's can be SEO Friendly and now I have a bit more free time on my hands would like to give back to Flex and RIA developers.

                         

                        PS if anyone else reads this I would love comments and suggestions about the site (Negative and Positive all welcome), find me on FB,

                         

                        Message was edited by: Mattr1981

                        • 9. Re: Can HTML wrapper use deep linking ?
                          eprevot123 Level 2

                          Thank you for sharing that.

                          There is something I didn't understand when I read about SEO and flash, and you mention it too :

                          Google would be able to read text in SWF...  so why do we have to use alternative content ?

                          • 10. Re: Can HTML wrapper use deep linking ?
                            Mattr1981 Level 1

                            Because depite the headless flash players abilty to get stuff from an swf, its not great. It might not read it all, or it might give up a few KB into the SWF. If it sees the ALT content, it will read that. Just make sure your alt is the SAME as your swf stuff. You dont want to be considered to be cloaking.

                            PS, read that no javascript message now, see how easy it is to change things. Using Flex makes site management and site changes really easy.