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 HTML5 Report Viewer or any of its wrappers to the DocumentName of the Report.
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
DocumentMapTextwill introduceDocument Mapin the Report. This way, theDocumentNameof the Report would be included in thebookmarkNodescollection of theargsobject of the renderingEnd event of the viewer.-
In the event handler of
renderingEnd, the name of the Report can be taken fromargs.bookmarkNodesand 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; } }); The
Document Mapmay be hidden in the viewer's initialization by setting thedocumentMapVisibleproperty tofalse- 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.