Orientation to the same browser tab from an external program

We open a web page when the user clicks a button from an external program (not a web page). The problem is that when the user returns to the program and opens another one, it opens in the same browser window, but with a different tab. After a few hours, our non-technical experienced customers have 30+ tabs that really slow down your computer.

The language we use in the external program is RPG (IBM iSeries). We did not find a way to configure the same tab from the RPG. The user sits on a specialized telnet session called 5250, where the server program (RPG) can call exe on a connected PC. It can also call a URL, and it will use the client’s default web browser. In this case, the only real parameter that you can specify is the URL itself, so we think that the solution should be completely in the browser. We could write an exe to invoke the browser, but that might prevent them from being ported to web applications.

Is there any way to achieve this using HTML / JavaScript / PHP / etc? We tried to have an external program call a script redirect (JavaScript), which would target the browser tab and then close. This would be a great solution if browsers weren’t so picky about security.

Firefox: there is a special parameter that you must set so that JavaScript can close the IE tab: it won’t pop up until the user selects “allow pop-ups from this domain”. but the original tab closes before the user does this. Chrome: Chrome kills the link to the named tab. Thus, each new pop-up window opens in a new tab anyway (even though they call up the same target name).

, . , , - - .

, - RPG , .

+4
3

, , . X-tab, x - . - /, . PHP, HTML, JS .. , ++/# , "", .

ajax. - . , 1. x ajax- script, , . .

, , :

$_SESSION['tabs'][1] = 'set';

, , "". ", 1". , 1 .

"2", . , 1 ajax, , . , JS :

javascript:window.open('','_self').close();

, , , , . , , .

+3

, , . , .

0

Have you considered creating a quick handover application that is called from an RPG router to process a browser request? This will allow you to indicate that the same tab should be used when creating a new request, as well as for sending certain parameters for customization. See This Answer from Karl Anderson ==> Reusing Browser / Tab in VB.net

similar code below:

Private Sub ToUrl(ByVal url As String, ByVal strDocType As String, ByVal strSSN As String)
        Dim IE As SHDocVw.InternetExplorer
        IE = GetTopmostInstanceOfCustomApp() ' Get the topmost instance of custom app (will return new instance if not running)
        If Not IE Is Nothing Then
            Dim Header As String = "Content-Type: application/x-www-form-urlencoded" & Chr(10) & Chr(13)
            SetForegroundWindow(IE.HWND)
            url = url & strCustomParameter
            IE.Navigate2(url, , , , Header)
        End If
End Sub
0
source

Source: https://habr.com/ru/post/1530472/


All Articles