How to Put the Report's DocumentName as a Title for the Browser Tab
Environment
Product | Progress® Telerik® Reporting |
Description
The article explains how to set the Document Title that will appear in the browser tab of the Web Page hosting the Html5 Report Viewer or any of its wrappers to the DocumentName of the Report. The referred sample project is built with the Html5 Web Forms Viewer.
Solution
- If the Report already has Document Map go to the next step. Otherwise, in the report definition set the DocumentMapText property of a report item (e.g. TextBox) to a valid value. The DocumentMapText will introduce Document Map in the Report. This way the DocumentName of the Report would be included in the bookmarkNodes collection of the args object of the renderingEnd event of the viewer.
- In the event handler of renderingEnd the name of the Report can be taken from args.bookmarkNodes and assigned to the title of the document:
function OnRenderingEnd(e, args) {
document.title = args.bookmarkNodes[0].text;
}
- The Document Map may be hidden in the viewer's initialization by setting DocumentMapVisible to 'false'.
A sample WebForms project in C# can be found in our samples GitHub repository - ReportNameAsWebPageTitle.