Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8149605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:53:13+00:00 2026-06-06T14:53:13+00:00

I have this jQuery code in my JSP page (jQuery 1.7.2) : function Header()

  • 0

I have this jQuery code in my JSP page (jQuery 1.7.2) :

   function Header() {
      this.add = function ( parentDiv, leftToolbar, rightToolbar ) {
         hbHeader = Handlebars.compile( $( "#hb-header" ).html() );

         $( parentDiv ).html( hbHeader( {user:{tenantDescription:"", firstName:"", lastName:""},
            leftTB:null, rightTB:null } ) );

         $.ajax( {
            url:"${pageContext.request.contextPath}/services/login/sessionUser",
            type:"POST",
            async:true,
            success:function ( result ) {
               app.user = result;
               var ltHtml;
               var rtHtml;
               if ( leftToolbar ) {
                  ltHtml = new Handlebars.SafeString( leftToolbar );
               }
               if ( rightToolbar ) {
                  rtHtml = new Handlebars.SafeString( rightToolbar );
               }
               $( parentDiv ).html( hbHeader( {user:app.user,
                  leftTB:{
                     html:ltHtml,
                     hidden:leftToolbar == null
                  },
                  rightTB:{
                     html:rtHtml,
                     hidden:rightToolbar == null
                  }
               } ) )
            },
            error:function( jqXHR, textStatus, errorThrown ) {
               alert("error in ajax");
            }
         } );
      }
   }

before this code is executed, an ajaxSend and an ajaxError listener are registered. Like so:

  $( "#log-window" ).ajaxSend( function ( event, jqXhr, ajaxOptions ) {
     console.log( "handling an ajax request adding username and password to the header" );
     jqXhr.setRequestHeader( 'username', $.cookie( 'username' ) );
     jqXhr.setRequestHeader( 'password', $.cookie( 'password' ) );
  } );
  $( "#log-window" ).ajaxError( function ( errorThrown, xhr, failedReq, textStatus ) {
     alert("error in "+failedReq.url);
     if ( textStatus == 'timeout' ) {
        if ( !failedReq.tryCount ) {
           failedReq.tryCount = 1;
           failedReq.retryLimit = 3;
        }
        if ( failedReq.tryCount++ <= failedReq.retryLimit ) {
           //try again
           $.ajax( failedReq );
           return;
        }
        throw 'Es wurde ' + failedReq.retryLimit + ' Mal versucht. Die Verbindung scheint nicht zu funktionieren.';
        return;
     }
     if ( xhr.status == 500 ) {
        if ( $.cookie( 'pageRefreshed' ) == null ) {
           $.cookie( 'pageRefreshed', 'true', { expires:10000 } );
           location.reload();
        }
        throw 'Der Server hatte ein Problem. Bitte melden Sie den Fehler and den Systemadministrator';
     } else if ( xhr.status == 401 ) {
        if ( failedReq.url != "${pageContext.request.contextPath}/services/login" ) {
           var loginData = {
              username:$.cookie( 'username' ),
              password:$.cookie( 'password' )
           };
           loginAttempt( failedReq, loginData );
        }
     } else {
        throw 'Oops! There was a problem, sorry.';
     }
  } );

The whole page can be accessed under http://alpha.sertal.ch:8181/VisionWeb/data-details/#data:12300923

You can even login if you like. User: alsoft03 Password: password

What should happen when the ajax call is made the first time, is a 401 error because the user is not logged in; and this is where IE fails. The ajaxSend listener is called but the ajaxError is not. If I set an error callback on the $.ajax itself it is not called either.

when I open the page with a real browser (Firefox, Chrome, Opera) it works fine and asks for a password. IE does not unless you press F12, in which case the site works as expected too.

It is really weird. You load the page with the console open and it works. With the console closed it does only show an empty header. Once the page has been loaded, you can close the console and it will continue to load.

I tested this on various machines and got the same result.

It drives me crazy. I can not debug because if I open the debugger with F12, it works fine.

I know the ajax callback is not made because I put alert("I got so far") lines at various positions.

If someone has a clue, it is very welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:53:13+00:00Added an answer on June 6, 2026 at 2:53 pm

    All instances of console.log() need to be removed from your script in order for it to work in IE9 without it being in developer mode.

    UPDATE I’m glad this answer has helped a few people. Just thought I’d update this answer with a simple solution I have been using from HTML5 Boilerplate:

    // Avoid `console` errors in browsers that lack a console.
    (function() {
        var method;
        var noop = function () {};
        var methods = [
            'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
            'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
            'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
            'timeStamp', 'trace', 'warn'
        ];
        var length = methods.length;
        var console = (window.console = window.console || {});
    
        while (length--) {
            method = methods[length];
    
            // Only stub undefined methods.
            if (!console[method]) {
                console[method] = noop;
            }
        }
    }());
    

    Place this before your code and it should help you avoid any console errors in browsers that lack a console.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this jQuery code: $(document).ready(function() { $.ajax({ url: pages/+page+.php, cache: false }).done(function( html
i have this jquery code $(#eioShowLink).on('click',function(){ $(#ioEditRelatedConcepts).html(''); $.getJSON(http://localhost/Mar7ba/Ontology/getRelatedConceptsAndRelations/+conceptName+/TRUE, function(data){ var concepts = data[0]; var
i have this jquery code $(document).ready(function(){ $(.C_bmiShowTableWord).click(function () { $(.C_bmiShowTable).slideDown(); }); }); if i
Suppose I have this jQuery code. $(document).delegate('a[title]', 'click', function(event) { var txt = //
On my main page I have this jquery code which does an ajax call
I have the following function call inside a jsp page. jQuery(function($){ $(#product).mask(99/99/9999,{placeholder: }); });
I have this jQuery code: $('#SomeLink').onclick = function(event) { alert('test'); }; And this is
I have this jQuery code: <script type=text/javascript> $(function() { $(.one-edition img).hover(function() { $(this).next(.editions-info-text).show(); },
I have picked up this code(DragandDrop.jsp) from this page :: http://jsfiddle.net/petersendidit/S4QgX/ I am getting
I have this JQuery code: jQuery(#form).click(function() { $(input[name='copyno']:checked).each(function() { checkboxData = copyno=+$(this).val(); id=$(this).val(); jQuery.ajax({

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.