Tip


quick tips can all go here


Thursday, March 8th, 2007

Another way to get around ActiveX silliness

Category: JavaScript, Tip

Eric Anderson has written his own script to get rid of the annoying “Click here to activate” IE now puts on all ActiveX controls (including Flash). There are other solutions such as UFO and SWFObject that we have discussed in the past. if (navigator.appName == “Microsoft Internet Explorer”) (function() { var onload = window.onload || Read the rest…

Posted by Dion Almaer at 6:52 am
16 Comments

+++--
3.3 rating from 29 votes

Friday, February 2nd, 2007

Stealing Events via Capture

Category: Tip

Are you the kind of person who has always written document.addEventListener(“keypress”, someFunc, false) and never really looked into the false bit. You just always keep it as false as that is how you copied it from some example the first time? Hallvord R. M. Steen explains what happens when you go true and capture events: Read the rest…

Posted by Dion Almaer at 2:31 am
4 Comments

+++--
3.8 rating from 26 votes

Monday, January 29th, 2007

Fun with browsers: for in loop

Category: JavaScript, Tip

Tobie Langel is having fun with for loops in JavaScript and wrote about how they are broken in Safari. This is the classic issue of looping through properties of an object, and getting all properties: < View plain text > javascript var Person = function(name) {   this.name = name; };   Person.prototype.name = ‘anonymous’; Read the rest…

Posted by Dion Almaer at 6:19 am
7 Comments

++++-
4.1 rating from 17 votes

Friday, December 22nd, 2006

Backbutton Overloading

Category: JavaScript, Tip

Mario Heiderich wonders if being able to do this is a bad thing: < View plain text > javascript window.onunload = function(){ location.replace(document.location); }; With this one line of code (test page here) you can keep a user around against their will, other than killing that tab/window.

Posted by Dion Almaer at 6:05 am
17 Comments

+++--
3.5 rating from 35 votes

Saturday, December 2nd, 2006

Wrapping the pre tag

Category: CSS, Tip

Making preformated text wrap in CSS3, Mozilla, Opera and IE is the tip that let’s you use the pre tag to keep the formatting, without cursing yourself when some of the content is too long and doesn’t wrap: < View plain text > css /* Browser specific (not valid) styles to make preformatted text wrap Read the rest…

Posted by Dion Almaer at 9:16 am
9 Comments

+++--
3.9 rating from 64 votes

Saturday, November 25th, 2006

DOMContentLoaded.Next

Category: JavaScript, Tip

Andrea Giammarchi has taken the work of Dean Edwards, Mark Wubben, and Paul Sowden to create his DOMContentLoaded Final Solution. The work comes with a test page for http and https, and is documented in this function: < View plain text > javascript function onContent(callback){ // (C) webreflection.blogspot.com     // [please note that this Read the rest…

Posted by Dion Almaer at 8:29 am
16 Comments

+++--
3.4 rating from 30 votes

Friday, November 24th, 2006

Another trick to allow Array subclasses

Category: JavaScript, Tip

Dean Edwards talked about his hack that got us the ability to subclass the Array object in JavaScript. Hedger Wang has a new hack that uses window.createPopup instead of an iframe to for IE to fix some issues. If you take a view source to see what is in there, you get the gem: < Read the rest…

Posted by Dion Almaer at 9:59 am
10 Comments

+++--
3 rating from 21 votes

Monday, November 20th, 2006

Sandboxing JavaScript with iframes

Category: JavaScript, Tip

Dean Edwards is hacking away again. This time he created a sandbox object that allows him to eval code outside of the context of window. His scenario was with templating: < View plain text > javascript // create an <iframe> var iframe = document.createElement("iframe"); iframe.style.display = "none"; document.body.appendChild(iframe);   // write a script into the Read the rest…

Posted by Dion Almaer at 6:21 am
7 Comments

++++-
4 rating from 26 votes

Saturday, November 11th, 2006

document.write and xhtml

Category: Tip

Sam Ruby knew that document.write doesn’t work well with XHTML so he went to find the best solution. His context: Because Google AdSense depends on document.write, the net result is that I only serve ads to users of browsers that don’t support XHTML, which increasingly means that only IE users see ads. His solution: The Read the rest…

Posted by Dion Almaer at 7:37 am
11 Comments

++++-
4.1 rating from 28 votes

Tuesday, September 26th, 2006

No More IE6 Background Flicker

Category: CSS, IE, Tip

Have you been bugged by IE background flicker? Cristi Balan talked about the issue and the solution: < View plain text > css html {   filter: expression(document.execCommand("BackgroundImageCache", false, true)); } Cristi links to a blog posting by Dan Popa, who discovered the IE6 background image flicker fix. And while you’re on Dan’s site, check Read the rest…

Posted by Dion Almaer at 8:55 am
25 Comments

++++-
4 rating from 74 votes

Friday, September 15th, 2006

Enabling Back/Forward-Button Support for ASP.NET AJAX UpdatePanel

Category: .NET, Tip

Scott Guthrie has written up a tip for Enabling Back/Forward-Button Support for ASP.NET AJAX UpdatePanel. For example, the below code could be written by a developer in response to a selection change within a list to to add the previous list selection to the browser’s history via Nikhil’s “HistoryControl”: < View plain text > javascript Read the rest…

Posted by Dion Almaer at 11:19 am
2 Comments

+++--
3.2 rating from 50 votes

Wednesday, August 16th, 2006

How to Profile and Optimize Ajax Applications

Category: Examples, Tip

So, you’re using Ajax in your application. Great. It’s chugging happily along, working well, doing it’s job, but you have this nagging feeling that you’ve forgotten something along the way. So, you wait and see if it comes up – and it does. In a bad way. Your application isn’t written for performance and things Read the rest…

Posted by Chris Cornutt at 8:08 am
3 Comments

+++--
3.6 rating from 24 votes

Thursday, July 27th, 2006

Pains of document.domain in FireFox 1.5

Category: JavaScript, Tip

Alexander Kirk has written about a problem with XHR, responseXML and document.domain in FireFox: This will work in IE, Safari, and Opera. This will not work in Firefox 1.0. This is very awkward but at least it has been fixed in 1.5. So it will work in Firefox 1.5. But: The responseXML object is useless. Read the rest…

Posted by Dion Almaer at 1:55 pm
9 Comments

++++-
4.1 rating from 17 votes

Tuesday, July 11th, 2006

Tuesday Morning Roundup

Category: JavaScript, Prototype, RichTextWidget, Ruby, Scriptaculous, Tip, WebKit

some stuff on Prototype, Safari and trailing commas, an Ajax design pattern, and a slide library

Posted by Rob Sanheim at 8:00 am
5 Comments

+++--
3.5 rating from 26 votes

Tuesday, June 6th, 2006

Ajax on IE 7: Check native first

Category: IE, Tip

I would hasten a guess that there is a lot of code out there that starts off with: < View plain text > javascript /*@cc_on         @if (@_jscript_version >= 5)                 try {                         Read the rest…

Posted by Dion Almaer at 8:55 am
11 Comments

+++--
3.6 rating from 37 votes

Friday, May 26th, 2006

Subscript Loader: Handling JS scope

Category: JavaScript, Tip

Weird Al over at MozillaZine has written up a little known Mozilla feature known as the JavaScript subscript loader in: JavaScript Scope through “subscript loaders”. Using this you can better handle scoping issues in JavaScript (albeit Mozilla only for now). < View plain text > javascript const scopeRegistry = {   subscriptLoader: Components.classes["@mozilla.org/moz/jssubscript-loader;1"]     Read the rest…

Posted by Dion Almaer at 10:07 am
2 Comments

++++-
4 rating from 48 votes