tags:

views:

164

answers:

2

When users want effects to happen between page loads (ie, old content fades out then new content back in), I typically build the site as follows:

index.php, about.php, etc...

<?php if(@$_SERVER['HTTP_X_REQUESTED_WITH']==''){include('includes/header.php');}?>
<content>blah blah blah</content>
<?php if(@$_SERVER['HTTP_X_REQUESTED_WITH']==''){include('includes/footer.php');}?>

this way, if Javascript is enabled, I can dynamically load the content and do whatever effect is desired, but the page still function if the jscript is disabled.

When I do this, though, is it possible to dynamically load meta tags/titles as well? ie:

<?php if(@$_SERVER['HTTP_X_REQUESTED_WITH']==''){include('includes/header-top.php');}?>
<meta http-equiv='description' content='stufffffff'>
<title>Page | ABOUT</title>
<?php if(@$_SERVER['HTTP_X_REQUESTED_WITH']==''){include('includes/header-bottom.php');}?>
<content>blah blah blah</content>
<?php if(@$_SERVER['HTTP_X_REQUESTED_WITH']==''){include('includes/footer.php');}?>

Is there any way to replace the title/meta tags with the jquery 'load' function? If I just want to replace .copy with the new .copy, I can do $('.copy').load($url+' .copy'), but is there any way to do this with the title and meta tags as well?

Also, if you have any suggestions on alternative methods here (if I'm going about this all wrong), please offer suggestions. Thanks!

+2  A: 

Can you leverage the IE page transition effect and then something else in Webkit and Firefox?

This seems like a weird rat hole to go down for an effect.

Anything you do in JavaScript for the most part will not be seen by search engines. So even if you could replace the meta tags it wouldn't do you much good.

Are you asking if you can do the second block in JavaScript?

If you want more info on Ajax and Google Search see: http://searchengineland.com/googles-proposal-for-crawling-ajax-may-be-live-34411

tyndall
Bradley Herman
A: 

I have recently just completed the major work for a site that does much of what you're trying to do.

I use the HIJAX technique, which is similiar to what you are doing. The major SEO concern is that your site be accessible with full titles, and meta keys, WITHOUT JAVASCRIPT. That is the way web spiders (google, bing, yahoo, et al) will crawl your site.

to make the site dynamic for visitors, I recommend embedding a hidden span inside of the content that is returned via ajax. Inside of this span, include the page title using PHP. then use javascript to get the content of that span, and set the document.title to it.

Summary:

  1. make the site function without javascript
  2. Add ajax to hijax links
  3. insert a hidden dom node inside of the returned ajax contents
  4. Parse that hidden node for it's title on ajax success, and set the document.title to it.
Bob Gregor