New to Telerik Reporting? Download free 30-day trial

Use 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 HHTML5 Report Viewer or any of its wrappers to the DocumentName of the Report.

Solution

  1. 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.

  2. 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:

    $("#reportViewer1")
            .telerik_ReportViewer({
                serviceUrl: "https://demos.telerik.com/reporting/api/reports/",
                reportSource: {
                    report: "ReportBook.trbp",
                },
                renderingEnd: function (e, args) {
                        document.title = args.bookmarkNodes[0].text;
                }
            });
    
  3. The Document Map may be hidden in the viewer's initialization by setting the documentMapVisible property to false - Initializing the HTML5 Report Viewer.

Demo Project

A sample ASP.NET Core project using the HTML5 Report Viewer can be found in our samples GitHub repository - ReportNameAsWebPageTitle.

In this article