Question : Set referer when open url with Shellexecute

Hello,

How can i set referrer when open an URL with shellexecute function

Answer : Set referer when open url with Shellexecute

You can't set the referrer if you're using shellexecute function.

To set the referrer you have to use COM object and IWebBrowser interface:

uses
  SHDocVw;

var
  Browser: IWebBrowser2; // it should be global or form's variable, but not local

procedure TForm1.Button3Click(Sender: TObject);
var
  Url, Flags, Headers, TargetFrameName, PostData: OLEVariant;
begin
  Browser:= CoInternetExplorer.Create;
  (Browser.Get_Application as IWebBrowserApp).Visible:= True;
  Flags := '0';
  TargetFrameName := '';
  PostData := '';
  Headers := 'Referer: ' + 'http://google.com' + #10 + #13;
  Url:= 'http://www.whatismyreferrer.com/';
  Browser.Navigate2(Url, Flags, TargetFrameName, PostData, Headers);
end;
Random Solutions  
 
programming4us programming4us