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
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 introduceDocument Map
in the Report. This way theDocumentName
of the Report would be included in thebookmarkNodes
collection of theargs
object of the renderingEnd event of the viewer.-
In the event handler of
renderingEnd
the name of the Report can be taken fromargs.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; } });
The
Document Map
may be hidden in the viewer's initialization by setting thedocumentMapVisible
property 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.