1

This isn't working in IE (although it does work in FFX). Why?

Using HTML in the header:

<script type="application/javascript">

    // And finally, let's call the code ourselves.
    window.onload = lbp.init;

</script>

And then the script:

// lbp is the script's universal variable, which retains everything
var lbp = {};

// The sequence of functions to trigger
lbp.init = function() {
    alert('hi');
}

Thanks in advance for your help =)

0

3 Answers 3

6

I don't know if IE supports application/javascript. Did you try text/javascript?

Also: is lbp initialized before setting window.onload?

Sign up to request clarification or add additional context in comments.

1 Comment

This is the correct answer! I will make it so as soon as my waiting period is up. It was application/javascript, just like you guessed. Thanks, I completely overlooked it =)
1

IE does not support application mime types except for with PDFs. This means IE will completely ignore your JavaScript. Change it to mime type text/javascript.

Comments

1

I think you have declared lbp after window.onload = lbp.init; code. Your code is not working because of the sequence issue.

Try the code in the following sequence.

<script type="text/javascript" language="javascript">
    var lbp = {};
        // The sequence of functions to trigger
        lbp.init = function() {
        alert('hi');
    }
        
    // And finally, let's call the code ourselves.
    window.onload = lbp.init;
</script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.