jQuery document ready bug in Safari / WebKit

There is an issue with the jQuery 1.3.2 document ready function in WebKit based browsers that which can cause numerous problems if you are manipulating the DOM, in my situation getting the width / height of an element.

Using the .width() and .height() methods were working fine in every other browser but Safari, which I thought was a little bit odd. After trying to come up with an alternative method of coding calculating the heights and comparing them in FireBug and Web Inspector, I set about Googling the problem. Continue reading “jQuery document ready bug in Safari / WebKit”

Resetting a Blackberry Bold to it's Factory Settings

In a similar manor the iPhone, you can download and install applications for the BlackBerry Bold, either via the BlackBerry App World or directly from the author’s website. Until recently I had been doing the latter, until one download caused an “Unexpected IO Error”.

I was unable to find any additional debugging information on the error, which was also preventing the SMS and MMS application from displaying or even functioning. Any messages that were sent to me didn’t appear to be reaching me, even read receipts were stating that the message had been delivered. Continue reading “Resetting a Blackberry Bold to it's Factory Settings”

CSS: Targeting Safari 3 only

Although Safari 3 tends to render layouts the same as the other leading popular browsers, it prefers to use it’s “aqua” button styling for standard sized form buttons.

One solution for this is to set a dimension (width or height) to the button.

To target Safari 3 in CSS you can use the following to add or override any existing attributes, such as the height of a button:

@media screen and (-webkit-min-device-pixel-ratio:0) {
	button {
		height: 40px;
	}
}

If required, multiple selectors can be added into a single block.

CSS: Extra Button Padding in IE

Today at work I was asked how to remove the extra padding added to buttons (both the button tag and input[type=button]) in Internet Explorer.

The Problem:

In the example below there is a standard button with 10px padding on all sides. Internet explorer chooses to add additional horizontal padding:

The solution:

After coming across this problem myself in the past, I eventually remembered that there are two CSS styles you can add to fix this bug feature in IE:

button {
	width: auto;
	overflow: visible;
}

Cross Browser CSS Layout Debugging

I’ve spent the majority of today fixing CSS layout issues to ensure my latest work project will look just as good in IE6 as it does in Firefox and the other major browsers.

I tend to stick to Firefox as my development browser to test a project as I go along, this way I can almost guarantee that the layout will look fine when browsing in Opera, Safari (Win) and even IE7/8.

Internet Explorer 6 on the other hand is a whole different ball game altogether, even in standards compliance mode things can take an age to get sorted, often finding yourself floating elements as well as adding in any filters as it is unable to render png transparency or opacity correctly.

At least Microsoft had got the majority of things right when they released Internet Explorer 7 and now with the beta release of IE8 with the IE7 rendering engine option things are looking up for web developers.

Unfortunately we will have to put up with the woes of IE6 and below, at least until the percentage of users drops to a more insignificant amount. Currently around 30% of users are still browsing using IE6 which is enough to put doubt into every developers mind as to whether or not they should bother with it.

Currently I have Firefox 2 / 3 beta, Opera 9, Safari (Windows) and IE 8 (with built in 7 rendering option) all installed on my PC. Both Opera and Firefox allow for multiple installs of different releases on a single machine, but when it comes to IE6 I’ve had to either use the stand alone version or use a Virtual Machine with an XP and IE6 Image.

The stand alone version from Evolt is fine up until the point where you are wanting to test any filters, css conditional statements or set up a proxy connection.

The the virtual machine option on the other hand will render everything as expected, but does require you to go through the booting up process and download the latest image every couple of months as they expire.

With my irritations of backward compatibility aside, I believe as developers we should all continue to dedicate some of our time allowing as many people as possibly to have the same browsing experience, even though it can be a major chore at times and testing in each browser can have it difficulties.

JS String Splitting in Internet Explorer

Over the past few days I have been working on a JavaScript based syntax highlighted code editor to add to my JS Library (known to some as the Juice Library).

I wanted to split the lines of code displayed into a series of words with any spacing preserved, so started off by splitting each line on any none word “W”.

var words = line.split(/W/g);

This worked fine in Firefox, but when it came to IE the results were not quite what I was expecting. All the words were matched but all white space had been completely ignored, so instead I turned to using “b” as the delimiter.

var words = line.split(/b/g);

This took me a step closer to what was required but it was still not the desired result as I didn’t want any non-word characters to be grouped with alpha-numeric values, such as “123”.

I spent a little – in fact too much -time browsing the web for some pointers and came across an article posted on the SitePoint blog outlining the inconstancies of the String.prototype.split method across different browsers, which seemed explained the problem I was getting earlier but unfortunately offered no resolution.

Now to try and find a solution to all this.

Because splitting on “W” was almost correct I reverted back to using that and now knowing what I had read over at SitePoint I somehow needed to prevent any non-word character sets from being ignored but without affecting the output in any way.

One possibility that arose was to wrap use the special character of null “” around each section and then split on that value. I tried a long winded version of the following to see if it would take me any closer to the desired result and simplified it afterwords.

var words = line.replace(/(W)/g, '$1').split('');

The output form this was pretty much almost what was required in both FF and IE, however it does not ease my frustration in the time wasted coming up and researching into this solution.

I can now continue on with my syntax highlighter in peace, or at least until the next major cross browser issue arises.

FF AdBlock add-on blocking local images

I received an email last night from a colleague regarding his recent visit to the Fubra site using the Firefox web browser. In his email Matt Wardy pointed out that he could not see the central image on the homepage relating to advertising.

Fubra Site - Adblock image issue

Whilst digging around for a reason he found that there was an inline style of “display: none;” applied to the image although no inline style was visible in the source code, which asked the question of where was it coming from?

As with many development and layout issues in Firefox they often come back to one of the many extensions or add-ons that you have installed – for example wondering why JavaScript isn’t working and then realising that it’s simply because you had disabled it earlier on to ensure your site will work without it enabled :S.

In this case it was found to be that AdBlock was installed, so by either disabling the AdBlock add-on or whitelisting the Fubra site and hitting refresh, all image problems appeared to have been resolved – for now.

A quick solution was applied for anyone visiting the site with AdBlock enabled in order to avoid the hiding of imagery.

For now I’ve renamed the images and it seems to have solved the problem.

I found it very interesting that the AdBlock extension would automatically block localised images simple because they contained the phrase ‘advertising’.

It seems to me that the add-on may be acting a little greedy here and should maybe only exclude images from third party websites containing this phrase or similar phrases if any.

After all, adverts are usually put in place for a reason and in a lot of cases without them it’s unlikely that the site would be there at all.