BrowserSetStandardHost Function

Action

Sets the replacement name for the predefined host name "standardhost". This replacement is only used for the BrowserNavigate function and is not used for Web functions. If not specified, the default setting is taken from the active profile settings (Settings > Active Profile > Internet > Hosts > Standardhost).

Include file

BrowserAPI.bdh

Syntax

BrowserSetStandardHost( sHost : in string,
                        nPort : in number optional ): boolean;
Parameter Description
sHost Replacement name for the predefined host name "standardhost".
nPort Optional: Port number appended to the replacement name.

Return value

  • true if successful

  • false otherwise

Example

benchmark SilkPerformerRecorder

use "Kernel.bdh"
use "BrowserAPI.bdh"

dcluser
  user
    VUser
  transactions
    TInit           : begin;
    TMain           : 1;

var

dclrand

dcltrans
  transaction TInit
  begin
  end TInit;

  transaction TMain
  var
    sHost : string;
    nPort : number; 
  begin 
    BrowserStart(BROWSER_MODE_DEFAULT, 800, 600);
    
    // get the standard host name & port and print them
    BrowserGetStandardHost(sHost, STRING_COMPLETE, nPort); 
    print("Standardhost: '"+sHost+"'");
    print("Port: '"+string(nPort)+"'");
    // set the standard host name to demo.borland.com and port to 80
    BrowserSetStandardHost("demo.borland.com",80);
    // Navigate to demo.borland.com on port 80
    BrowserNavigate("http://standardhost");
    // set the standard host name to www.google.com and port to 80
    BrowserSetStandardHost("www.google.com");
    // Navigate to www.google.com
    BrowserNavigate("http://standardhost");
    
    // revert to previous state
    BrowserSetStandardHost(sHost, nPort);
  end TMain;