Loading ...
Sorry, an error occurred while loading the content.
 

Re: Browser History Manager IE 7

Expand Messages
  • rupnaldo
    ... navbar ); ... state ) { ... a ); ... Hi, I#m a little bit frustrated, why no one anserws any questions a posted. There are serveral reasons I decided
    Message 1 of 3 , Sep 29, 2007
      --- In ydn-javascript@yahoogroups.com, "rupnaldo" <rupnaldo@...> wrote:
      >
      > Hi,
      >
      > I've problem using the BHM. The results for the ajax response are in
      > inc/content.php. But this won't work. I've no idea what's going wrong
      >
      > function loadSection( section ) {
      > var url = "inc/content.php";
      >
      > function successHandler( obj ) {
      > // Use the response...
      > YAHOO.util.Dom.get( "col3" ).innerHTML = obj.responseText;
      > }
      >
      > function failureHandler( obj ) {
      > // Fallback...
      > location.href = "?section=" + section;
      > }
      >
      > YAHOO.util.Connect.asyncRequest( "GET", url,
      > {
      > success:successHandler,
      > failure:failureHandler
      > }
      > );
      > }
      >
      > var bookmarkedSection = YAHOO.util.History.getBookmarkedState(
      "navbar" );
      > var querySection = YAHOO.util.History.getQueryStringParameter(
      > "section" );
      > var initialSection = bookmarkedSection || querySection || "home";
      >
      > YAHOO.util.History.register( "navbar", initialSection, function(
      state ) {
      > // Load the appropriate section:
      > loadSection( state );
      > } );
      >
      > function initializeNavigationBar() {
      > // Process links
      > var anchors = YAHOO.util.Dom.get( "nav" ).getElementsByTagName(
      "a" );
      > for ( var i=0, len=anchors.length ; i<len ; i++ ) {
      > var anchor = anchors[i];
      > YAHOO.util.Event.addListener( anchor, "click", function( evt ) {
      > var href = this.getAttribute( "href" );
      > var section = YAHOO.util.History.getQueryStringParameter(
      > "section", href ) || "home";
      > try {
      > YAHOO.util.History.navigate( "app", section );
      > } catch ( e ) {
      > loadSection( section );
      > }
      > YAHOO.util.Event.preventDefault( evt );
      > } );
      > }
      >
      > var currentSection = YAHOO.util.History.getCurrentState( "app" );
      > if ( location.hash.substr(1).length > 0 ) {
      >
      > if ( currentSection != querySection )
      > YAHOO.util.Dom.get( "col3" ).innerHTML = "";
      > loadSection( currentSection );
      > }
      > }
      >
      > YAHOO.util.History.onLoadEvent.subscribe( function() {
      > initializeNavigationBar();
      > } );
      >
      > try {
      > YAHOO.util.History.initialize();
      > } catch ( e ) {
      > initializeNavigationBar();
      > }
      >
      > regards
      > mic
      >

      Hi,

      I#m a little bit frustrated, why no one anserws any questions a
      posted. There are serveral reasons I decided to tryout the yui
      framework. But this Browser History manager don't work in these
      terrible MS-Browsers.



      Regards
      Mic
    • rupnaldo
      Hi, one last try ;) So I figured out the main problem: The response is generated in inc/content.php . If I implemment this in the following way function
      Message 2 of 3 , Sep 30, 2007
        Hi,

        one last try ;)

        So I figured out the main problem:

        The response is generated in 'inc/content.php'. If I implemment this
        in the following way

        function loadSection( section ) {
        var url ='./inc/content.php';


        there is no change in the query string. The ajax-request works fine
        but the is no history-save!

        If I split this content.php in news.php ,... and change load section

        function loadSection( section ) {
        var url ='./inc/'+ section + ".php";

        everything' allright.

        So is there a way to implement the BHM in the way I decribed in
        solution one?

        Regards
        Mic
      Your message has been successfully submitted and would be delivered to recipients shortly.