# Browser Title

**URL:** <https://techcommunity.softwareag.com/t/browser-title/90964>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, NaturalONE, Natural-for-AJAX\
**Created:** [August 19, 2009, 5:30pm UTC](https://techcommunity.softwareag.com/t/browser-title/90964 "2009-08-19T17:30:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpn](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@rpn](https://techcommunity.softwareag.com/u/rpn)\
**Post date:** [August 19, 2009, 5:30pm UTC](https://techcommunity.softwareag.com/t/browser-title/90964/1 "2009-08-19T17:30:36Z")

</div>

How can you change the browser title.  
I am using URL [http://pcukrpn1:8080/cisnatural/servlet/StartCISPage?PAGEURL=/cisnatural/NatLogon.html](http://pcukrpn1:8080/cisnatural/servlet/StartCISPage?PAGEURL=/cisnatural/NatLogon.html)  
to start my NJX.  
The browser title is as above.  
I can pass parameter &POPUPTITLE=This%20is%20a%20new%20title  
to the above URL and the title does change but how can this be done ‘in code’ i.e. in StartCISPage or NATLOGON.HTML  
or by the adapters generated for NJX.

What about screens that don’t have adapters/pages?

---

<div class="post-metadata">

**Author:** ![Christine\_Zimmermann](https://avatars.discourse-cdn.com/v4/letter/c/839c29/32.png) [@Christine\_Zimmermann](https://techcommunity.softwareag.com/u/Christine_Zimmermann)\
**Post date:** [August 19, 2009, 6:00pm UTC](https://techcommunity.softwareag.com/t/browser-title/90964/2 "2009-08-19T18:00:19Z")

</div>

In your question I read 3 cases for which you would like to modify the browser title:

1. StartCISPage  
Passing the POPUPTITLE as paramter is a good solution for this. You have already done this. What is missing for your use case here?

2. Natural ADAPTER  
Settin the Browser title from within Natural code can be done in the following way:

2.1) In your layout page add an xcidatadef control. Set dataprop=“mytitleprop”  
2.2) Add an adapter listener to the page. This is done via setting the property “adapterlistener” in the natpage control  
Example: adapterlisteners=“com.mycompany.MyListener”  
2.3) Implement a very small Java Adapter Listener:

```auto
class MyListener implements IAdapterListener              
...                                                       
public void init(Adapter adapter){ m_adapter = adapter;}  
...                                                       
public void reactOnInvokePhaseEnd() {    
   if ( m_adapter instanceof IDynamicAccess){                                
     String theTitle = (String)((IDynamicAccess)m_adapter).getPropertyValue("
 mytitleprop");                                                           
     m_adapter.getCISAddons().setBrowserTitle(theTitle);                     
 }         
```

2.4) At runtime simply apply a corresponding value to your mytitleprop field. The value will be used as Browser title.

1. No pages/adapters  
Do you mean WEB/IO pages?

Best Regards,  
Christine

---

<div class="post-metadata">

**Author:** ![rpn](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@rpn](https://techcommunity.softwareag.com/u/rpn)\
**Post date:** [August 19, 2009, 6:26pm UTC](https://techcommunity.softwareag.com/t/browser-title/90964/3 "2009-08-19T18:26:12Z")

</div>

1. StartCISPage  
Passing the POPUPTITLE as paramter is a good solution for this. You have already done this. What is missing for your use case here? - The URL could already be hardcoded in places, so wuold need to be changed.

2. Natural ADAPTER  
Settin the Browser title from within Natural code can be done in the following way:

2.1) In your layout page add an xcidatadef control. Set dataprop=“mytitleprop”  
2.2) Add an adapter listener to the page. This is done via setting the property “adapterlistener” in the natpage control  
Example: adapterlisteners=“com.mycompany.MyListener”  
2.3) Implement a very small Java Adapter Listener:  
Code:  
class MyListener implements IAdapterListener  
…  
public void init(Adapter adapter){ m\_adapter = adapter;}  
…  
public void reactOnInvokePhaseEnd() {  
if ( m\_adapter instanceof IDynamicAccess){  
String theTitle = (String)((IDynamicAccess)m\_adapter).getPropertyValue("  
mytitleprop");  
m\_adapter.getCISAddons().setBrowserTitle(theTitle);  
}

2.4) At runtime simply apply a corresponding value to your mytitleprop field. The value will be used as Browser title.

This sounds like a good solution where pages exist. Where and how do you implement the Java Adapter Listener?  
Where and how do you give a value to mytitleprop - in Natural adapter?

1. No pages/adapters  
Do you mean WEB/IO pages? - Yes, I understand that some Natural screens can be NJX’ed but others can remain as they are and still be displayed. How do you influence the browser title for these?

The STARTCISPAGE shows defined Connections. How can I take the chosen connection name and make that the browser title ?

---

<div class="post-metadata">

**Author:** ![Christine\_Zimmermann](https://avatars.discourse-cdn.com/v4/letter/c/839c29/32.png) [@Christine\_Zimmermann](https://techcommunity.softwareag.com/u/Christine_Zimmermann)\
**Post date:** [August 19, 2009, 9:07pm UTC](https://techcommunity.softwareag.com/t/browser-title/90964/4 "2009-08-19T21:07:42Z")

</div>

1. StartCISPage: If the url is hardcoded and should not be changed you could apply a servlet-filter which can add the Parameter. But this is probably only worth the effort if you have many hard-coded urls. It might be simpler to replace them

2. NATURAL Adapter:  
The value of the “mytitleprop” in the example is set by the NATURALAdapter  
I actually posted nearly the complete adapter listener implementation. Simply create your .java class via copy & paste of the code.  
Then put the corresponding .class file into the \appclasses\classes. For more info please see the Application Designer documentation under cisnatural\cisdocumentation

3. WEB/ IO Pages: I don’t think it’s currently possible.

Best Regards,  
Christine

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:57pm UTC](https://techcommunity.softwareag.com/t/browser-title/90964/5 "2021-04-02T14:57:23Z")

</div>


