As in the TODO file:
Redirect on other pages than front-page to the dynamic url.

Tried this code. Works great.

/**
 * Implementation of hook_boot().
 */
function asynchronous_boot() {
  $uri = request_uri();
  $pattern = '/(^\/$)|(^\/#.*)|(^\/\?q=(.*)?&page_renderer=)/';
  if (!preg_match($pattern, $uri)) {    
    $fragment = substr($uri, 1);
    // ./includes/common.inc (where drupal_goto() resides) hasn't been loaded
    require_once './includes/common.inc';
    drupal_goto('', null, $fragment);
  }
}
CommentFileSizeAuthor
#4 asynchronous.js_.txt455 bytesmani.atico
#3 asynchronous.module.txt947 bytesmani.atico

Comments

mani.atico’s picture

sorry, something wasn't working with forms. here is the correct code.

function asynchronous_boot() {
  $uri = request_uri();
  $pattern = '/(^\/$)|(^\/#.*)|((&|\?)page_renderer=)/';
  if (!preg_match($pattern, $uri)) {    
    $fragment = substr($uri, 1);
    // ./includes/common.inc (where drupal_goto() resides) hasn't been loaded
    require_once './includes/common.inc';
    drupal_goto('', null, $fragment);
  }
}
recidive’s picture

Code looks great, but will that degrade so to work when javascript is disabled?

Can you submit a patch?

Thanks.

mani.atico’s picture

StatusFileSize
new947 bytes

Here is the patch, and yes it causes trouble on browser with javascript disabled.
I tried solving it by checking the 'has_js' cookie variable, but it's not the best option since it has not been registered the first time you visit the site. This gives problems when the access to the site might be a link (with a hash fragment) posted on another site or when the user types the site url with a hash fragment. And of course it doesn't work on browser where cookies are disabled (not tested yet).
I guess there should be a javascript workaround.

mani.atico’s picture

Status: Active » Needs review
StatusFileSize
new455 bytes

Here is a javascript patch. It works on Chrome, FireFox and IE7 although the test have been lightly done. An in-depth test is needed.
Update: May not work on sites where basePath is not '/'.