1

Ajax ディープリンクを使用したテスト用のワードプレス ブログがあります。私がやりたいことは、ajax がページまたは投稿をロードするときに新しいヘッド タイトルを設定することです。

アンカー タグ属性のタイトルまたはハッシュ URL 名で呼び出します。

どんな助けでも大歓迎です。

http://missionandromeda.com/test/初期テストページ

$("body").append("<img src='loader.gif' id='ajax-loader' style='position: absolute; left: 50%; top: 64%;' />");

var base = 'http://missionandromeda.com/test',
$mainContent = $("#container"),
$ajaxSpinner = $("#ajax-loader"),
$allLinks = $("a"),


$('a:urlInternal').live('click', function(e) {


// Default action (go to link) prevented for comment-related links (which use onclick attributes)
e.preventDefault();

});



$.address.change(function(event) {
    if (event.value) {
        $ajaxSpinner.fadeIn();
        $mainContent
        .empty()
        .load(base + event.value + ' #content', function() {
            $ajaxSpinner.fadeOut();
            $mainContent.fadeIn();
    });
}

var current = location.protocol + '//' + location.hostname + location.pathname;
    if (base + '/' != current) {
    var diff = current.replace(base, '');
    location = base + '/#' + diff;
}
});
4

2 に答える 2

0

Firefoxでのみテストされていますが、ここでは機能します。

$(document).attr('title','Your brand new title here ....');
于 2011-12-13T15:08:15.350 に答える
0

もっとダイナミックなものを探します..とにかくここにあります

$('head title').html(data.match('<title>(.+)</title>')[0].replace('<title>','').replace('</title>',''));
于 2012-02-18T14:27:52.130 に答える