WebDrawer preview page Links / Actions button

The problem

In some versions of WebDrawer you might have this experience:

  • preview a document,
  • select the Links / Actions button, then
  • find yourself back at the main search page.

The cause

As is often the way a fix to one thing led to a breakage somewhere else.  Some documents (such as email items) contain links to attached files.  These links were breaking. To 'fix' this the following code was added to WDRecordPreview.cshtml.

@section customhead {
    @* This is so links in VMBX files do not link to /RecordHTML*@
    <base href="~/Record/" />
}

Unfortunately the 'base' element broke the link in the Links / Actions menu.

Resolution

Later releases of WebDrawer fix this issue in one of two ways:

  1. embed the preview HTML via an iframe so that the 'base' element is no longer required, or
  2. fix the links in the HTML so that the 'base' element is no longer required. 

Fixing the HTML

WDRecordPreview.cshtml contains this line of code:

@record.Html.Replace("src=\"", "src=\"../Record/")

Replace it with this:

@record.Html.Replace("src=\"", "src=\"../Record/").Replace(string.Format("href=\"{0}", record.Uri), string.Format("href=\"../Record/{0}", record.Uri)).AsRaw()

Also remove the customhead section containing the base element.

Written on May 1, 2015