Hi everybody,
is it possible to show the name of the report in the title bar of
Internet Explorer? My users have muliple IE-applications open, all
with different reports. They would like to see the name of the report
in the windows taskbar instead of "Report Manager - Microsoft Internet
Explorer".
Anybody any thoughts?
Thanks in advance, Vivian.The reason it says Report Manager in the title bar is because the WEB
application sets it to do so. This isnt controlled by the report.
I have a solution for you although it will require some development.
All Reports are generated from the Report.aspx located under the
"ReportManager\Pages\" folder
You CAN add a <title>Report Name</title> title tags in the ASPX file.
The actual ASPX file looks empty, but you can place HTML code in there.
You can write javascript code to read the ItemPath parameter - this is
the parameter for the path of the report. It is in the query string.
This will allow you to get the Report Name.
Then you just use the following code to set the title:
document.title = "Report Name"
regards,
Stas K.|||Here add this into report.aspx:
<script>
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
//alert('Query Variable ' + variable + ' not found');
}
</script>
<script>
var query2 = getQueryVariable("ItemPath")
document.title =query2.substring(query2.lastIndexOf('%2f')+3,query2.length);
</script>|||Heh,
I never thought of this. This helped me too. The executives were very
appriciative.
regards,
Stas K.|||Looks good Stas! Will test it first thing monday morning.
Thanx, Vivian|||Great code.
I extended it a bit, to replace the +s between each word with a space.
This is my updated script:
<script>
// function getQueryVariable and page script found at
//
http://groups.google.com/group/microsoft.public.sqlserver.reportingsvcs/browse_thread/thread/39e5747688f51268/d0a6a49f6891dfd4
// function replace found at
//http://www.rgagnon.com/jsdetails/js-0043.html
//Purpose of code: Replace page title "Report Manager" with the report name
in Report Manager
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
//alert('Query Variable ' + variable + ' not found');
}
function replace(s, t, u) {
/*
** Replace a token in a string
** s string to be processed
** t token to be found and removed
** u token to be inserted
** returns new String
*/
i = s.indexOf(t);
r = "";
if (i == -1) return s;
r += s.substring(0,i) + u;
if ( i + t.length < s.length)
r += replace(s.substring(i + t.length, s.length), t, u);
return r;
}
</script>
<script>
var query2 = getQueryVariable("ItemPath")
query2 = query2.substring(query2.lastIndexOf('%2f')+3,query2.length);
query2 = replace(query2, '+', ' ');
document.title =query2
</script>
- Again, great idea and great code. :)
Kaisa M. Lindahl Lervik
"Sorcerdon" <sorcerdon@.gmail.com> wrote in message
news:1144426083.140501.223890@.v46g2000cwv.googlegroups.com...
> Here add this into report.aspx:
> <script>
> function getQueryVariable(variable) {
> var query = window.location.search.substring(1);
> var vars = query.split("&");
> for (var i=0;i<vars.length;i++) {
> var pair = vars[i].split("=");
> if (pair[0] == variable) {
> return pair[1];
> }
> }
> //alert('Query Variable ' + variable + ' not found');
> }
> </script>
> <script>
> var query2 = getQueryVariable("ItemPath")
> document.title => query2.substring(query2.lastIndexOf('%2f')+3,query2.length);
> </script>
>|||Hello I am trying this function and it is not working for me. I get a
javascript error message that says query2 is null or not an object. What am I
missing?
Thanks!
--
Kevin
"Sorcerdon" wrote:
> Here add this into report.aspx:
> <script>
> function getQueryVariable(variable) {
> var query = window.location.search.substring(1);
> var vars = query.split("&");
> for (var i=0;i<vars.length;i++) {
> var pair = vars[i].split("=");
> if (pair[0] == variable) {
> return pair[1];
> }
> }
> //alert('Query Variable ' + variable + ' not found');
> }
> </script>
> <script>
> var query2 = getQueryVariable("ItemPath")
> document.title => query2.substring(query2.lastIndexOf('%2f')+3,query2.length);
> </script>
>
No comments:
Post a Comment