Discuss Scratch

AdamLaughlin
Scratcher
66 posts

Internet Explorer - Give it a Whirl

We squashed many IE bugs last week.

IE8 and IE9 should be operating on par with Chrome and Firefox. Try it out!

Please post in this thread if you have any issues.

Cheers!

Adam Laughlin - Scratch 2.0 Front-End Developer
Windows 7. Chrome, Firefox, IE8, IE9.
Generally active on Tuesdays and Thursdays.
BoltBait
Scratcher
1000+ posts

Internet Explorer - Give it a Whirl

Did you rev the editor or are we still on v207?

I just cleared my cache and refreshed this page before responding and the annoying “Your leaving this page” message came up when I tried to submit my post.

Last edited by BoltBait (Jan. 8, 2013 14:14:26)


Click to play:
AdamLaughlin
Scratcher
66 posts

Internet Explorer - Give it a Whirl

We're on SWF version 207, though the SWF version is unrelated to the unloading and forum issues.

Just did it in IE8 and IE9 after refreshing. Empty cache. Both times it submitted correctly. Weird. I'll look around.

How are projects working for you?

Last edited by AdamLaughlin (Jan. 8, 2013 16:15:10)


Adam Laughlin - Scratch 2.0 Front-End Developer
Windows 7. Chrome, Firefox, IE8, IE9.
Generally active on Tuesdays and Thursdays.
AdamLaughlin
Scratcher
66 posts

Internet Explorer - Give it a Whirl

Are you getting the error in both IE8 and IE9?

I found what would cause the problem in IE8. The developers of this forum code used a function that didn't exist in IE8.

Notes to self:
Line 64 in board.js. var text = obj.val().trim();

Hmm. That shouldn't run on any browser when clicking submit though. window.onbeforeunload is getting reset with
$("form input").click(function() {
window.onbeforeunload = null;
});

Last edited by AdamLaughlin (Jan. 8, 2013 16:21:12)


Adam Laughlin - Scratch 2.0 Front-End Developer
Windows 7. Chrome, Firefox, IE8, IE9.
Generally active on Tuesdays and Thursdays.
BoltBait
Scratcher
1000+ posts

Internet Explorer - Give it a Whirl

This was on Chrome on Win7. And, its still happening.

Click to play:
nXIII
Scratcher
1000+ posts

Internet Explorer - Give it a Whirl

AdamLaughlin
Notes to self:
Line 64 in board.js. var text = obj.val().trim();
Just curious—what's wrong with that?

Hmm. That shouldn't run on any browser when clicking submit though. window.onbeforeunload is getting reset with
$("form input").click(function() {
window.onbeforeunload = null;
});
It might be better to use the submit event:
    $("form [type=submit]").click(function() {
        //log("unbind onbeforeunload");
        window.onbeforeunload = null;
    });
An alternative solution might be to use a boolean flag—that's what I used for preventing double-posting. (I apologize for any errors; I didn't test this )
!function () {
    var submitted = false;
    var MIN_CONTENT_LENGTH = 4;
    $(window).bind('beforeunload', function() {
        if (submitted) return;
        var obj = $("textarea#id_body");
        if (!obj.length || obj.val().trim().length < MIN_CONTENT_LENGTH) return;
        // TODO: Translate string
        return "Leave page with unsaved content?";
    });
    $("form [type=submit]").submit(function() {
        submitted = true;
    });
}();

EDIT: Oh, and that magic number should at least be in a constant (a setting would be better, but…)

Last edited by nXIII (Jan. 8, 2013 17:43:57)


nXIII · GitHub
AdamLaughlin
Scratcher
66 posts

Internet Explorer - Give it a Whirl

Thanks nXIII.

String.trim() is part of ECMAScript 5, which wasn't implemented in IE until IE9.
http://kangax.github.com/es5-compat-table/

That's why jQuery has the $.trim(' foo ‘) method. The DjangoBB developers used $.trim() in other files. Unsure why they didn’t use it there too.

That said, it doesn't explain why boltbait would be getting the error in Chrome, and I can't reproduce on the same OS and same browser. I'm implementing additional error tracking code right now so we hopefully get a better picture of what's happening.

Adam

Adam Laughlin - Scratch 2.0 Front-End Developer
Windows 7. Chrome, Firefox, IE8, IE9.
Generally active on Tuesdays and Thursdays.
BoltBait
Scratcher
1000+ posts

Internet Explorer - Give it a Whirl

I'm not getting any of those messages today.

Did you change something?

Last edited by BoltBait (Jan. 9, 2013 13:46:32)


Click to play:
AdamLaughlin
Scratcher
66 posts

Internet Explorer - Give it a Whirl

BoltBait
I'm not getting any of those messages today.

Did you change something?

Nope. Glad to hear it's working for you!

Adam Laughlin - Scratch 2.0 Front-End Developer
Windows 7. Chrome, Firefox, IE8, IE9.
Generally active on Tuesdays and Thursdays.
nXIII
Scratcher
1000+ posts

Internet Explorer - Give it a Whirl

AdamLaughlin
String.trim() is part of ECMAScript 5, which wasn't implemented in IE until IE9.
http://kangax.github.com/es5-compat-table/

That's why jQuery has the $.trim(' foo ‘) method. The DjangoBB developers used $.trim() in other files. Unsure why they didn’t use it there too.
Ah, of course. Thanks for explaining

nXIII · GitHub

Powered by DjangoBB