cancel
Showing results for 
Search instead for 
Did you mean: 

Change the browser title

Former Member
0 Kudos
41

Hi All.

I wanna know if there exists an api that allows me to change the title of the browser dinamically. I mean that the title of the browser will change depending of some actions and events, and i want to do this change programatically.

I hope somebody can helps me.

Thx

Best Rgds.

Gregory.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Gregory,

TaskBinder.getCurrentTask().getApplicationWindow().setTitle("Hi, Greg!")

Note the following:

1. Non-documented methods were used.

2. It is tested to work in stand-alone WD application, I have no clue what happens in portal.

VS

Former Member
0 Kudos

Thanks for correcting me Valery.. I was also thinking that most probably I have posted a silly answer... by the way what is this TaskBinder? Purposes?

Former Member
0 Kudos

Don't worry about TaskBinder, simply don't use it

Armin

Former Member
0 Kudos

It is being set by the title property of your window.

Former Member
0 Kudos

Ok, good.

But that is a static property. And i need to change it dynamically.

thx ans rgds

Gregory

Former Member
0 Kudos

Hi Gregory,

hope you want to change the default window title i.e. the browser title on some event. You can try the following solution

<b>create two static variables for the view controller class:</b>//@@begin others

private static IWDWindow window;

private static boolean changeWindowTitle = false; //for checking whether to change the title or not

//@@end

<b>In the event handler method create the window object for the default window of your application:</b>

public void onActionChangeWindowTitle(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent)

{

//@@begin onActionselectedMyStep(ServerEvent)

IWDWindowInfo winInfo = wdComponentAPI.getComponentInfo().findInWindows("DefaultWindow");

window = wdComponentAPI.getWindowManager().createModalWindow(winInfo);

changeWindowTitle = true;

//@@end

}

<b>Now in wdDoModifyView check the condition and set the new title:</b>

public static void wdDoModifyView(IPrivateTestCompView wdThis, IPrivateTestCompView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if(changeWindowTitle){

((Window)window).setTitle("My New Window Title");

}

//@@end

}

Let me know whether it works or not...

regards,

Shubhadip

Former Member
0 Kudos

Shubhadip,

1. Component (and therefore all of its controllers) is created per session (also there are could be several instances of the same component even per session) so using static variables is a "no-no"

2. As I understand the question it is necessary to change title of current main application window (not a pop-up)

VS