Page 1 of 1

Link substitution

Posted: Fri Jan 25, 2019 4:05 pm
by dilfich
How can I improve?
Doing this now...
Replace https://www.site.com/img/black.png on https://www.my_site.com/img_bak/now.png

Code: Select all

procedure TChr.BeforeResourceLoad.............
var
  u: TUrlParts;
begin
    if (Pos( '/img/black.png', request.Url) <> 0) then begin
     if CefParseUrl(request.Url, u)then begin
       u.scheme:= 'https';
       u.host := 'www.my_site.com';
       u.origin := 'https://my_site.com/';
       u.path := '/img_bak/now.png';
       u.query := '';
       request.Url := CefCreateUrl(u);
      end;
    end;
end;
This is true or can be as the otherwise or easier?

Re: Link substitution

Posted: Fri Jan 25, 2019 4:22 pm
by salvadordf
Your code seems OK to me.