Extraneous Code in SEO Sample?

  • HookahDude

    HookahDude - 2007-11-27


    I've been using SWFAddress for a little while (which works great!) and now I'm working on upgrading to version 2. I have 2 questions about the SEO sample, and certain design decisions contained within.

    QUESTION 1 --

    What does the seo() function in swfaddress-seo.js actually do?

            <script type="text/javascript" src="<?php swfaddress_resource('/swfaddress/swfaddress-seo.js'); ?>"></script>
            <script type="text/javascript">
            // <![CDATA[
                <?php swfaddress_seo(); ?>
            // ]]>
    QUESTIONS 2 --
    In the downloaded seo sample code (div content) links look like this:

        <a href="/swfaddress/samples/seo/" onclick="SWFAddress.setValue('/'); this.blur(); return false;">SWFAddress Website</a>
    but at http://www.asual.com/swfaddress/samples/seo/ (div content) links look like this:

        <a href="/swfaddress/samples/seo/">SWFAddress Website</a>
    It seems to me that the setValue() function should only be necessary for ajax implementation, and can be removed from the seo sample?

    • Rostislav Hristov

      QUESTION 1:
      This function performs the JavaScript redirection which converts addresses like http://domain.com/folder/ to http://domain.com/#/folder/
      It uses a synchronous XHR that sends the current path to the server and saves it in a session variable. After the redirect the session variable is used for the generation of proper content and after that it's deleted.

      Generally the idea is to have a client-side redirect that produces exactly the same markup as the original page. This is why I call it "non-sneaky redirect" which conforms with the Google guidelines.

      QUESTIONS 2:
      You're completely correct. I incidentally copied some of the Ajax code to the SEO sample and it went as a part of the release. The setValue() is not needed for Flash SEO.

      Currently I'm working on 2.1 and the SEO part is being improved, especially for cases when Flash Player is not available. You can find the updated files in the SVN.

    • HookahDude

      HookahDude - 2007-11-28

      Thanks for the info.

      So as far as the synchronous ajax stuff goes... how was this implemented in version 1.1? Does this code replace some of the .htaccess mod_rewrite stuff?

      Also, I am getting some surprising results when looking at the source code of the following urls when they are entered directly into the IE6 address bar... (cleared cache & reloaded browser prior to test)

      http://www.asual.com/swfaddress/samples/seo/about/ <enter>
      [ about page displayed ]
      <script type="text/javascript">seo("/about/", "/swfaddress/samples/seo", "8");</script>

      http://www.asual.com/swfaddress/samples/seo/portfolio/ <enter>
      [ portfolio page displayed ]
      <script type="text/javascript">seo("/about/", "/swfaddress/samples/seo", "8");</script>

      http://www.asual.com/swfaddress/samples/seo/contact/ <enter>
      [ portfolio page displayed again! ]
      <script type="text/javascript">seo("/about/", "/swfaddress/samples/seo", "8");</script>

      Does this make sense? Is it a documented bug?

    • HookahDude

      HookahDude - 2007-11-28

      In revision 419 (/trunk/swfaddress/samples/seo/index.php) you removed the swfaddress_seo code. Am I looking at the correct file?

      • Rostislav Hristov

        Yes, this code is replaced by something new which is called SWFAddressOptimizer. It has a built-in Flash detection, so that Flash websites can gracefully degrade to a working HTML version when needed.

        The IE6 issue you're experiencing is caused by the fact the there is an IE check in the PHP code that creates browser caching of the PHP response. It's there to fix the Refresh button in IE which is broken by default with dynamic pages. All this causes the effect you've seen, but only in IE. The new SWFAddressOptimizer ensures that the # redirection and the caching will work only when the Flash version of the site is viewed.


Log in to post a comment.