Archive

Posts Tagged ‘Safari’

Safari JavaScript image resizing bug

October 25th, 2007

Safari seems to have a bug when it comes to swapping image sources using JavaScript. It seems that when swapping images, Safari will stretch the new image to the dimensions of the previous image.

View Test Page

This is a serious issue if you are building a cross-browser JavaScript image gallery. But there is hope, there are a couple of workarounds.

Workaround 1:

Load a blank or invisible image with the height and width of 1 pixel just before you load your replacement image.

Workaround 2:

Before you change the image source set the images style.display to ‘none’, swap the image src and then set the image back to style.display = ‘block’

Here’s an example of a basic image swap function with the Safari bug fix:

function swapImage() {
var imgElm = document.getElementById('preview');
imgElm.style.display = 'none';
imgElm.src = newImgSrc;
imgElm.style.display = 'block';
}
<img rc="firstImage.jpg" alt="image preview" id="preview" />

Cameron Web Development

Changing Safari’s Default Search Engine

October 9th, 2007

I decided that I needed to change the default search provider in Safari from Google-US to Google-UK. I thought that this would be a five second trip to Safari preferences, how wrong was I.

For some strange unknown reason Apple has decided to hard code the search provider (Google US) into the Safari application itself. I found various guides on the internet on how to change the default search provider, but they all required use of the Terminal and the not very easy to use editor Vi. Not forgetting that if you make any mistake when editing, it will render Safari completely useless.

After almost giving up I did one last search on Google and came across an excellent Safari plug-in AcidSearch. This plug-in not only lets you change the default search provider in Safari, it also lets setup multiple search providers which you can search on via a handy drop-down menu.

It seems development on AcidSearch has ceased and no longer works with latest version of Safari. All is not lost though as I have found a worthy replacement. Introducing Inquisitor! Inquisitor does a lot more than just allow you to change the default search engine, it completely enhances the entire search experience.

Website: http://www.inquisitorx.com/safari/

Cameron Software , ,

Run Multiple Versions of Safari

October 9th, 2007

One of the things that you’ve been able to do in IE on the PC for years is run multiple versions along side each other on the same machine. But Mac users wanting to do this with Safari have been out of luck, that is until now.

Today I stumbled upon Multi-Safari which claims to work round this problem. You have to install special packaged versions of Safari which can be download from the site. Each version contains the relevant version of WebKit and the Safari web browser. Installing these special versions of Safari do not overwrite the main WebKit, so you can safely install these without fear of damaging the main Safari installation.

Cameron Software, Web Development , ,