0

IE8 keeps throwing error Permission denied:

  • jquery-1.7.2.min.js | Line:2, Char:21695
  • jquery-1.7.2.js | Line:1712, Char:4

(depend on which version I use).

It happens when I press enter (function on 'Enter' jump around tabindexes). And it happens only on specific server and specific PC group who uses IE8.

[EDIT] It happens when calling

$("[TabIndex='"+tabindex+"']").focus()
$("[TabIndex='"+tabindex+"']").blur()

Full code

//WALKING with ENTER
        var tabindex = 1; //start tabindex || 150 is last tabindex
        $(document).keypress(function(event) {
            var keycode = (event.keyCode ? event.keyCode : event.which);
            if(keycode == '13') { //onEnter
                if($("[TabIndex='"+tabindex+"']").attr('id') == 'submit_btn'){ //if on 'sbm - button' click!
                    $("#submit_btn").click();
            return false;
                };
                $("[TabIndex='"+tabindex+"']").blur()//.removeClass('highlight_input');
                tabindex++;
                //while element exist or it's readonly and tabindex not reached max do
                while(($("[TabIndex='"+tabindex+"']").length == 0 || $("[TabIndex='"+tabindex+"']:not([readonly])").length == 0) && tabindex != 150 ){
                    tabindex++;
                }
                if(tabindex == 150){ tabindex = 1 } //reseting tabindex if finished
                $("[TabIndex='"+tabindex+"']").focus()//.addClass('highlight_input');
                return false;
            }
        });

I can reproduce this error only Logging off/re-logging Windows(XP) -> going back to this interface and pressing 'Enter'. After F5: everything works fine.

Has anyone already experienced something like this before?

Community
  • 1
  • 1
karlisup
  • 672
  • 12
  • 22
  • check this, it may help: http://stackoverflow.com/questions/11502122/jquery-keypress-event-for-cmds-and-ctrls/11502343#11502343 – Barlas Apaydin Jul 18 '12 at 08:46
  • that way wont return permission denied on ie8 – Barlas Apaydin Jul 18 '12 at 08:54
  • At this moment I can't get access to the test-srv, but I think that the problem is not how the event's "onEnter" been helded, but how jquery reacts on selectors like $("[TabIndex='"+tabindex+"']").focus(). Anyway I shall try your solutinon once i get to srv. Thanks – karlisup Jul 18 '12 at 09:32

1 Answers1

0

Problem occurred when blur() or focus() ware called, so i had to find workaround. Task was to call (almost) pure javascript instead of calling jquery focus/blur.

//Focus workaround for IE8 (exception)
var elid = $('input[tabindex='+tabindex+']').attr("id");
var element = document.getElementById(elid); 
element.blur(); 

var elid = $('input[tabindex='+tabindex+']').attr("id");
var element = document.getElementById(elid); 
element.focus(); 

instead of

$("[TabIndex='"+tabindex+"']").blur()
$("[TabIndex='"+tabindex+"']").blur()

Drop a comment if you have any questions or you have faced the same problem.

karlisup
  • 672
  • 12
  • 22