-1

I'm using current jQuery plugin (address) and I have this code (I'm using "SEO" method of address plugin)

$(document).ready(function() {
    $.address.crawlable(1).state('/').init(function() {
        $('body').delegate('.ajax', 'click', function() {
            $('.ajax').address();
        });
        $('.ajax').address();
    }).change(function(e) {
        var loc = document.location.href;
        if (loc != 'http://secret.riseofkings.net' + e.value) {
            var myStr = e.value;
            myStr = myStr.substr(1);
            if (myStr) {

                $("#content").html('<img src="/images/ajax.gif" />');
                $("#iframe_space").html('<iframe src="http://riseofkings.net/nothing.php" style="display:none"></iframe>');
                var url = $(e).val().toLowerCase().substr(1).replace(/ /g, '%20');
                $("#content").load(url + '&ajax=1', function() {
                    $("#iframe_space").html('');
                }, function(errr) {
                    alert('Something went wrong. Sorry for problems');
                });
            }
        }
    });
});

UPDATE:

when I try to add

alert(loc+' vs http://<?php echo $security->host()."'"; ?>+e.value);

after

if (loc != 'http://secret.riseofkings.net' + e.value) {

it gives me http://secret.riseofkings.net/game.php vs http://secret.riseofkings.net/ When I go to link (/game.php?what=map) it alerts http://secret.riseofkings.net/game.php vs http://secret.riseofkings.net/game.php?what=map

ENDUPDATE;

UPDATE2:

this is happening, for example in Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2

ENDUPDATE;

but in some Firefox versions (3.XX) and IE there is an infinite loop. I do visit main page, and it starts to reload and to append #/game.php?r=something to the end of address in address bar.

Don't you know what's wrong there?

genesis
  • 50,477
  • 20
  • 96
  • 125

2 Answers2

1

Well this line:

clearTimeout = window.clearTimeout(timer);

is wrong and scary; should be just:

clearTimeout(timer);
Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
Pointy
  • 405,095
  • 59
  • 585
  • 614
0

I had a similar problem with JQuery Address in my asp.net MVC site. if i clicked back to a page with a hash url it would freak out and endlessly loop the page. it turned out the problem was linked to an old version of MicrosoftAjax.js and MicrosoftAjax.debug.js files that come standard with mvc.

if you open the MicrosoftAjax.debug.js file and you see FileVersion: 4.0.20526.0 (which is the default version with the mvc template) then upgrade the debug and compressed versions from the cdn (http://www.asp.net/ajaxlibrary/CDNAjax4.ashx)

please note this solution was found in another question here on stack overflow, so its not my solution. im trying to find the original question and who gave the solution.

EDIT : Firefox 6 Infinite Page Refresh With Page With Hash Tags

Community
  • 1
  • 1
spaceman
  • 1,628
  • 1
  • 16
  • 19