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

  • Home
  • SEARCH
  • 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 8489347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:48:16+00:00 2026-06-10T21:48:16+00:00

This is working fine everywhere except for IE, when you click #doorbell IE says

  • 0

This is working fine everywhere except for IE, when you click #doorbell IE says view.knock is null or not an object and fails out, I’m guessing it has something to do with the bind function in enableKnock and its not passing event data?

Solved: I changed the detectKnock function to:

detectKnock: function(e) {
    e = e || window.event;
    e.data.knockInput.push({
        time: (new Date()).getTime()
    });

    clearTimeout(e.data.completeId);
    e.data.completeId = setTimeout(e.data.completeKnock, 1200);
    e.preventDefault();
    return false;
},

the error happens here:

e.view.knock.knockInput.push({
     time: (new Date()).getTime()
});

HTML

<button id="doorbell">Push Me</button>

Javascript

var knock = Object();
knock = {
    successCallback: '',
    secretKnock: '',
    knockInput: [],
    reject: 0.25,
    averageReject: 0.15,
    fadeTime: 150,
    completeTime: 1200,
    completeId: '',
    lastNow: '',
    clickEventType: ((document.ontouchstart!==null) ? 'click':'touchstart'),

    enableKnock: function (callback, knock) {
        this.successCallback = callback;
        this.secretKnock = knock;
        $('#doorbell').bind(this.clickEventType, this, this.detectKnock);
    },
    disableKnock: function() {
        $('doorbell').unbind(this.clickEventType, this.knock.detectKnock);
        clearInterval(completeId);
    },
    detectKnock: function(e) {
        var now = new Date().getTime();
        e.view.knock.knockInput.push({
            time: (new Date()).getTime()
        });

        clearTimeout(e.view.knock.completeId);
        e.view.knock.completeId = setTimeout(e.view.knock.completeKnock, 1200);
        e.preventDefault();
        return false;
    },
    completeKnock: function() {
        if (this.knock.validateKnock()) {
            this.knock.successCallback();
        }
        this.knock.knockInput = [];
    },
    validateKnock: function() {
        var maxTime = 0;
        var times = [];
        var time;
        var result = true;
        var dist, i;
        var timeDiff, totalDiff;

        if (this.secretKnock.length == this.knockInput.length) {
            for (i = 1; i < this.knockInput.length && result; ++i) {
                time = this.knockInput[i].time - this.knockInput[i - 1].time;
                times.push(time);
                maxTime = Math.max(maxTime, time);
            }

            for (i = 0; i < times.length && result; ++i) {
                timeDiff = Math.abs((times[i] / maxTime) - this.secretKnock[i].delay);
                totalDiff += timeDiff;
                if (timeDiff > this.reject) {
                    result = false;
                }
            }

            if (result && totalDiff / times.length > this.averageReject) {
                result = false;
            }
        } else {
            result = false;
        }
        return result;
    }
};

    // Shave-and-a-haircut, two bits!
    var secret = [
        {delay:0.5},
        {delay:0.25},
        {delay:0.25},
        {delay:0.5},
        {delay:1},
        {delay:0.5},
        {delay:0}
    ];

    knock.enableKnock(allowInside, secret);

    function allowInside() {
        $('#sub_header').remove();
        $('#images').html('<div class="row" id="welcome"><div class="span12"><h1>Welcome to the afterparty.</h1></div></div>');
        $('body').fadeOut(7500);
        setTimeout( function() {  window.location='party.html' }, 1500 );
    }
  • 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-10T21:48:17+00:00Added an answer on June 10, 2026 at 9:48 pm

    On IE 8, event DTOs are only members of the window object, and not passed onto event listeners, hence any attempted invocation on e returns null:

    detectKnock: function(e) {
        var now = new Date().getTime();
        e.view.knock.knockInput.push({
            time: (new Date()).getTime()
        });
    
        clearTimeout(e.view.knock.completeId);
        e.view.knock.completeId = setTimeout(e.view.knock.completeKnock, 1200);
    //---^----- error on null access 
        e.preventDefault();
        return false;
    }
    

    From quirksmode.org:

    In the Microsoft event accessing model there is a special property
    window.event that contains the last event that took place.

    Source

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

Sidebar

Related Questions

This is working fine in core php, but not in magento. $party_payment = new
I am recrusively evaluating properties via reflection using object.GetType().GetProperty(string propertyName). This is working fine
This is working fine in Firefox and IE, but I can't get this to
I am using RijndaelManaged to make a simple encryption/decryption utility. This is working fine,
I send email through Outlook using VB.Net 2005; this is working fine. At the
I use the devise's authenticate_user! method in a controller. This is working fine when
So basically this code was working fine before. I had some computer issues and
For some reason this statement is working fine: vms.Where(vm => vm.MessageType == ValidationMessage.EnumValidationMessageType.Warning) But
Let me start by saying that this app was working fine the day before.
<a href=details.php?phoneid=1><img src=phone01.jpg></a> When I write the code like this it's working fine. But

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.