SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member Peralta's Avatar
    Join Date
    Mar 2011
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MaintainScrollPositionOnPostback in Firefox 4.0

    Unfortuantly, MaintainScrollPositionOnPostback stopped working in Firefox 4. This breaks our websites and needs to be fixed.

    I've added the following to our App_Browsers folder in our .NET 4/IIS7 website:

    Code HTML4Strict:
    <browsers>
      <browser id="Firefox4" parentID="Firefox">
          <identification>
              <capability name="majorversion" match="4" />
          </identification>
     
          <capabilities>
              <capability name="supportsMaintainScrollPositionOnPostback" value="true" />
          </capabilities>
      </browser>  
    </browsers>

    Yet, support for MaintainScrollPositionOnPostback remains false for Firefox 4. I've also have tried changing several other properties and none of them are affecting the defaults for firefox. Please help.

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Location
    Marysville, CA
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've never been able to find a good fix for this. My only suggestion would be to use combination of divs and jQuery.

  3. #3
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,576
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Back in 2002 or so when I started doing this .NET thing they told us "this doesn't really work, does bad stuff to web pages, should be avoided." In 2011 we've got ajax to handle this pretty effectively, which is where I'd turn.

  4. #4
    SitePoint Evangelist
    Join Date
    Apr 2008
    Location
    Dublin, Ireland
    Posts
    461
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The original MaintainScrollPosition was the dodgy one. Some clever person came up with the idea of 2 hidden fields (xpos, ypos) who had a value of 0. On scroll script would update the values and as long as these hidden fields were asp.net controls then on postback they would retain any values. Your script would simply check if these hidden fields had values greater than 0 on page load and scroll to the position if so. I'm pretty sure asp.net (possibly version 2.0 and later) switched to this method from the earlier IE specific one that caused issues.

    The upshot of all this is that you don't need to rely on asp.net to do this if it stubbornly decides Firefox is not capable. Simply implement it yourself by manually adding the hidden fields and writing the script. A bit of hassle but can be easily re-used.

  5. #5
    SitePoint Member Peralta's Avatar
    Join Date
    Mar 2011
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think maybe I'll just try to avoid MaintainScrollPositionOnPostback and make the site more AJAX enabled. And maybe the next framework update will include newer .browser files for the areas that need to keep the scroll position. I'd still love to figure out why I cannot get any changes I make to app_browsers to get picked up.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •