Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CL_GUI_HTML_VIEWER in own window GUI

Former Member
0 Kudos

Hi.

How to force CL_GUI_HTML_VIEWER to open links always in own window GUI.

Including links javascripts

10 REPLIES 10

athavanraja
Active Contributor
0 Kudos

<i>always in own window GUI.</i>

you mean within the same control? if yes you should avoid adding target attribute in the links.

Regards

Raja

0 Kudos

>you mean within the same control?

yes

Itself HTML the page is created not by me and I cannot change it

0 Kudos

then you wont have control over it.

Regards

Raja

0 Kudos

For example program SAPHTML_DEMO1.

The following link-

<a href = " javascript:open_card (' card.aspx? ID =09013c72800e2dec ') ">sss</a> 

javascript code

function open_card( strField )
{
 window.open(strField, "","location=0,directories=0,toolbar=0,menubar=0,resizable=yes,height=400,width=400,top=50,left=50");
}

Opens a new window from window GUI - in IExlorer

How to make, that the link opened in same window GUI

0 Kudos

do the following change. (bold)

window.open(strField, <b>'_self'</b>,"location=0,directories

Regards

Raja

0 Kudos

Thanks )))

But as I already spoke, corrects a code of a HTML-page I cannot.

He is on an external site.

I only can correct an ABAP-code of the program.

0 Kudos

i mentioned that before. if its external site then , you dont have control over it. you cannot do anything.

Regards

Raja

0 Kudos

Whether it is possible to intercept links, for the analysis and redefinition?

Message was edited by:

Sergey Petrov

0 Kudos

not really intercept. but what you could do is make your ABAP program to act as HTTP client (using cl_http_client class) and read the contents of the page and search for these links, modfy them and show the modified contet (which is your own html) - but this will cause other problems if there are relative links in that page (i am sure it will certainly have), and there are lot of other issues involved with that.

So the only option out to just live with this.

Regards

Raja

0 Kudos

Please check SAP Note 856741.

After creating the HTML Viewer control, call the method ENABLE_SIMPLEBROWSING as follows:

CALL METHOD html_control->ENABLE_SIMPLEBROWSING

EXPORTING

benable = 1.

Now the links will open in the same SAP GUI session.