Gracefully handling HttpRequestValidationException with AJAX

In the various links i've posted earlier, I also had one regarding the graceful handling of HttpRequestValidationException. The idea of manipulating the Response to deliver a nicer error page is good, but there is one problem: AJAX will just show a Popup instead.

HttpRequestValidationException AJAX Popup

HttpRequestValidationException AJAX Popup

So, how can we handle THAT gracefully? If you are thinking: Just handle AsyncPostBackError in the ScriptManager, you're wrong, as this error handler is not called for HttpRequestValidationException as it's caught outside of the page. You have to catch this error Client-Side using JavaScript.
There is an article on AJAX which deals exactly with this: Customizing Error Handling for ASP.NET UpdatePanel Controls. At the bottom of the article, you'll find the client-side JavaScript for it.
I've combined it with the "Disabling a Button in an AJAX UpdatePanel" method, so my JavaScript within my .aspx Page looks like this now. Needs some more tweaking in the status-code, but you'll get the idea. Also note the use of inline-ClientId at the bottom.

<script type="text/javascript" language="javascript">
var pbControl = null;
var prm = Sys.WebForms.PageRequestManager.getInstance();

function BeginRequestHandler(sender, args) {
  pbControl = args.get_postBackElement();  //the control causing the postback
  pbControl.disabled = true;

function EndRequestHandler(sender, args) {
  pbControl.disabled = false;
  pbControl = null;

  if (args.get_error() != undefined)
    var errorMessage;
    if (args.get_response().get_statusCode() == '200')
      errorMessage = args.get_error().message;
      // Error occurred somewhere other than the server page.
      errorMessage = 'An unspecified error occurred. ';
    $get('<%= this.newsletterLabel.ClientID %>').innerHTML = errorMessage;