a[i].getAttribute("href") is null in Firefox 3

5 posts, 1 answers
  1. Wei
    Wei avatar
    33 posts
    Member since:
    Oct 2008

    Posted 10 Dec 2008 Link to this post

    umm... what is this error I see on every pages?

    a[i].getAttribute("href") is null


    It seems in this function: (line 33 is where it breaks)

    1 // Iterates through all the <a> links on a page and adds   
    2 // them to the queue to be prefetched.  
    3 function doEnhancedPrefetch(aEvent, pos) {  
    4  
    5     // exit if enhanced prefetching is turned off  
    6     // or if the site has opted out of prefetching  
    7     if(!PreferencesService.getBoolPref("extensions.fasterfox.enhancedPrefetching")) return;  
    8       
    9     // doc is document that triggered "onload" event  
    10     var doc = aEvent.originalTarget;   
    11       
    12     // if this isn't an http:// page, retun  
    13     if (doc.location.href.indexOf("http://") != 0) return;  
    14           
    15     // load whitelist  
    16     var whitelist = PreferencesService.getCharPref("extensions.fasterfox.whitelist").split(",");  
    17     var whitelistLen = whitelist.length;  
    18       
    19     // find all links  
    20     var a = doc.getElementsByTagName('a');  
    21     var href, numLinksToPrefetch, i, j;  
    22       
    23     // prefetch a max of 100 links  
    24     numLinksToPrefetch = (a.length>100) ? 100 : a.length;  
    25  
    26     // if its the first time, set the pos to 0,  
    27     // if a pos was passed in, we'll start the for loop there instead  
    28     if (pos == null || pos <=0) pos = 0;  
    29       
    30     // iterate through the links  
    31     mainLinkLoop:   
    32     for (i=pos; i<numLinksToPrefetch; i++) {  
    33         href = a[i].getAttribute('href').toLowerCase();  
    34           
    35         // make sure there is a link  
    36         if(href && href.length > 4) {  
    37  
    38             // Don't prefetch links w/ query strings  
    39             // or the same page we are on  
    40             if(href.indexOf('?')>=0 || href == doc.location.href) continue;  
    41               
    42             // Don't prefetch things that look like a logout link  
    43             // Special thanks to b1naryb0y and Kai Risku for this bug fix  
    44             if(href.indexOf('logout')>=0 || href.indexOf('logoff')>=0) continue;  
    45               
    46             // Only prefetch static content, this causes dynamic pages to be ignored  
    47             fileExtensionStartPos = href.length-4;  
    48             if(!(href.indexOf('.htm') == fileExtensionStartPos   
    49               || href.indexOf('.html') == fileExtensionStartPos-1  
    50               || href.indexOf('.jpg') == fileExtensionStartPos  
    51               || href.indexOf('.gif') == fileExtensionStartPos  
    52               || href.indexOf('.png') == fileExtensionStartPos  
    53               || href.indexOf('.jpeg') == fileExtensionStartPos-1  
    54               || href.indexOf('.txt') == fileExtensionStartPos  
    55               || href.indexOf('.text') == fileExtensionStartPos-1  
    56               || href.indexOf('.xml') == fileExtensionStartPos  
    57               || href.indexOf('.pdf') == fileExtensionStartPos)) continue;  
    58                 
    59             // Don't prefetch whitelist links  
    60             href = ff_GetAbsoluteUrl(href, doc.location.href);  
    61             for(j=0; j<whitelistLen; j++) {  
    62                 if(whitelist[j].length > 0 && href.indexOf(whitelist[j]) >= 0) continue mainLinkLoop;                 
    63             }  
    64               
    65             // test if site is opting out of prefetching  
    66             var shouldOptOut = ff_IsSiteOptOut(href, aEvent, i);  
    67             if(shouldOptOut) {  
    68                 continue;  
    69             } else if (shouldOptOut == -1) {  
    70                 return;  
    71             }  
    72               
    73             try {  
    74                 PrefetchService.prefetchURI(ff_makeURI(ff_GetAbsoluteUrl(a[i].getAttribute('href'), doc.location.href)), ff_makeURI(doc.location.href), true);  
    75             } catch(e) {   
    76                 //if(e.name != "NS_ERROR_ABORT") alert(ff_GetAbsoluteUrl(href, doc.location.href) + '\n' + e.toString());   
    77             }  
    78         }  
    79     }  
    80  
    81 }  
    82  

  2. DGDev
    DGDev avatar
    42 posts
    Member since:
    Jul 2012

    Posted 21 Dec 2008 Link to this post

    I have the same problem.
    Have not yet pin-pointed whats causing it though. Strange it only exists with Firefox 3.

    http://www.example.com/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_ctl00_ScriptManager_HiddenField&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a8ac4a3ed-a467-4f19-a8ed-9270f6e4c6d6%3aadbe97d5%3a6a5df9aa%3bTelerik.Web.UI%2c+Version%3d2008.3.1105.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a99dd44ed-99f9-4eed-a93e-6ebfddaf3eb2%3afe8d4455%3a170a45d3%3adcf52240%3ac7991a52%3acc662d70%3a3e33fb52%3a9265f342%3a5f3d0562%3afe3916f2%3ab33f49a2
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 22 Dec 2008 Link to this post

    Hi guys,

    Can you please verify that this issue appears under FireFox 3 browser only and prepare a working demo (using our RadScriptManager control) which replicates it? Thus we will be able to investigate the matter further and provide an accurate explanation/solution. You can attach the example to a regular support ticket in order to send it to us.

    Kind regards,
    Sebastian
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Wei
    Wei avatar
    33 posts
    Member since:
    Oct 2008

    Posted 22 Dec 2008 Link to this post

    My problem is related to add-in FasterFox. With the removal of FasterFox the problem solved itself!
  6. Answer
    DGDev
    DGDev avatar
    42 posts
    Member since:
    Jul 2012

    Posted 22 Dec 2008 Link to this post

    Funny you should mention that, I just installed FasterFox today. I never saw any error before installing it, so this must be the cause.

    If you disable "Enhanced Prefetching", you will not receive this error anymore.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017