Get current location/host


1. I want to load data relative to the current location like TMSFNCGrid1.LoadFromFile('/somefolder/somefile.csv')
I guess this is not possible, so I try to fiddle the location to load from myself.
2. Is there a simple way to get the current location and/or hostname of the loaded page at runtime ('http://www.myhost.com' or 'http://www.myhost.com/index.html')

3. I tried to get the current location this way

procedure TForm3.WebButton1Click(Sender: TObject);
var aurl: String;
begin
  asm
    aurl = window.location;
  end;
  WebMemo1.lines.Add(aurl); //works fine
  WebMemo1.lines.Add(copy(aurl,1,5));   //doesn't work
end;



It does not work that bad - I get the location, but I cannot use the string I get in the next copy-command.
What's wrong in my code and how can I improve that ?
Thanks, Tom

window.location returns a JavaScript object.
To get the URL as string, please use:


aurl = window.location.href;

fyi, a 100% Pascal approach would be to include the unit web in the uses list and write (without the need to use an ASM block): 


aurl := window.location.href;
Cool - thanks - that was what I was looking for !

Regards, Tom