Thursday, 27 December 2012

IE7 and contentEditable

IE7 and contentEditable

Interestingly (I'm playing it rather loose and free with the term 'interestingly' here) I found that removing the contentEditable attribute from some elements cause them to become editable in IE7. The senario is this, HTML comes in, you don't know if it contains contentEditable attributes, but if it does you want to remove them. Run a function on the HTML to remove attributes. This was being done in jQuery.

$("*").removeAttr("contenteditable");

The effect of the above was some elements became editable in IE7, also list-items where missing their markers (common IE behaviour if contentEditable is true) running a function to set the attribute to false...

var els = document.getElementsByTagName("*");
for (var i = 0; i < els.length;i++){
    els[i].contentEditable = false;
}

... this will stop the content from being editable in IE7 but wouldn't fix the missing bullet markers. I still can't find a fix for this, so resorted to cleaning the HTML and stripping out the contentEditable attributes on the server before sending the HTML down to the client. (You can always rely on IE to give you something to do! : )

Also, interestingly *cough*, an embedded browser in a .NET app will use the oldest version of IE loaded on the machine, rather than the newest. So if your client is using IE9, it's still quite likely that they have something like IE7 in your .NET app. Worth setting the metadata X-UA-Compatible to IE=edge, this seems to have the effect to force the system to use the latest installed version of IE.

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
As the above may cause validation errors, you might want to put this in your apache config instead...

Header set X-UA-Compatible "IE=edge"

Where ever you set this header, remember where it is, I have a nasty feeling it'll need editing at short notice at some point in the future!




Monday, 17 December 2012

Brr, it's cold in here...

It was the Crisis Mid-winder swim on Saturday which involves a quick dip in Brockwell lido. The water was crystal clear, blue and a sharp 4 deg C.



Creating an Ubuntu 12 launcher for Chrome to use a proxy-server.

To create a new launcher...
  1. Type 'menu' into the Dash dialogue (alt + F2) this should bring up the Main Menu manager
  2. Select Internet from Menus
  3. Highlight Chromium Web Browser and select Properties, leave that open so you can duplicate it 
  4. Create a new menu item and duplicate the existing menu item, call it something sensible though
  5. Add what ever options you require and close


That should be it, now you can search for your launcher in Dash. You'll need to close any open chrome browsers before launching a new one. Using this method means you don't need to change your proxy settings globally and you can set up a load of links using different proxies to run as and when needed.
 

Note: the opinions on this page don't represent that of my employer in anyway. And, actually only vaguely represent my opinions on the date of publication. (Unlike Ms T, I am very much for turning)