Monday, July 17, 2006

Pointless, intentional browser crippling - why??

I was browsing an online store earlier, trying to find a certain orthodontic product that I didn't know the name of, when I finally found it.

There were no useful details about it on that site, though, so I just wanted to copy and paste the official product name into a google search. My efforts to do this simple task were denied, though, which confused and annoyed me.

I thought my Firefox may have been choking on the fact that I had a lot of windows and tabs open, but decided to view the source anyway. As it turns out, there was some javascript code (shown below) to intentionally [attempt to] prevent printing or text selection. WTF?!?


//Disable Printing
document.onselectstart=new Function('return false');
function ds(e){return false;}
function ra(){return true;}
document.onmousedown=ds;document.onclick=ra;


This was easy enough to defeat, though, by entering this in my location/address bar:
javascript:void(document.onmousedown=ra)

In IE, an additional step was required:
javascript:void(document.onselectstart=ra)

I'm not sure what they were trying to accomplish. All I wanted to do was research the product before buying it from them, but intentionally made that difficult for me, so I will not be purchasing anything from their store.

1 comments:

Dave O said...

The only semi-valid reason I can think of to disable text selection is when you have drag-and-drop widgets happening on your page via dhtml + javascript. You don't want a drag operation to highlight text in the process. I tried this with Google Calendar and it re-interprets the click-drag selection as a calendar-box-range-selection, which is kind of nice. But I don't see anything that fancy or useful on the dental site! Plegh!