3

If i trying to load page with LoadString with recource load in it, for example:

< style>

        body {

            Background-Image:url(local://c/Background.gif);
            Background-Repeat:No-Repeat;
            Background-Size: 100% 100%;

        }

< /style>

It not loading this recource, it gives Not allowed to load local resource error in console.
Question: What i need to do, for fix this problem or maybe workaround it?
TNX

Priler
  • 149
  • 1
  • 10
  • Start by *not using a local resource*, just like the error message is telling you. Load your resource from a proper URL, like `./background.gif` or `images/background.gif`, instead of using `local://c/`. Web pages typically don't have access to local folders at will; they're usually in a proper location under the web site's folders. (Imagine any old web page loading data from your machine, reading from anywhere it wanted? Can you say "major security flaw"?) – Ken White Aug 09 '13 at 20:34
  • I've allmost tryed it, not works... – Priler Aug 09 '13 at 20:35
  • How do you "almost try it"? – Ken White Aug 09 '13 at 20:59
  • 1
    Like this `Background-Image:url(../img/Background.gif);` – Priler Aug 09 '13 at 22:13
  • Why are you using `../`? That means "up one level from where you're at, then into the `img` folder, and load `Background.gif`". Is the folder one level up accessible? (If it is, it probably should not be. It looks like you need a tutorial on basic web programming and security first.) – Ken White Aug 09 '13 at 22:16
  • I know what does it means. Exactly it can't work, because if i will write this `../img/Background.gif`, it will be relative path, but exactly there is no .html file as it is, i'm running this from my Application, so relative to what this path will be? – Priler Aug 09 '13 at 22:21
  • To the current directory as far as your application is concerned, of course. It doesn't magically go somewhere else. Did you think it just grabs a starting path at random? Use `SysUtils.GetCurrentDir` to find out which directory your app thinks is the current one. – Ken White Aug 09 '13 at 22:24
  • Well, i placed `Background.gif` in the project root, and writed this : `Background-Image:url(Background.gif);` but its still not works – Priler Aug 09 '13 at 22:32
  • I said before (in my *first comment*): Load your resource from a proper URL, like `./background.gif`. (Please see `./` before the image name, which means "from the current directory" - I know, you're going to complain that you already knew that, but you're not using it.) – Ken White Aug 09 '13 at 22:36
  • I didnt used it, but i've tried just now ` Background-Image:url(./Background.gif);` and its still not works :) – Priler Aug 09 '13 at 22:38
  • 1
    Instead of having this silly back and forth, just edit your web page until it loads properly when you double-click it in Windows Explorer and loads in your default browswer, because the links are relative to the page. If it won't load the background when your default browser loads the page, it won't load in TChromium. I can't see your computer from here, so I can't troubleshoot your problem using details you keep trying to add in comments. – Ken White Aug 09 '13 at 22:42
  • Just place TChromium components into Form, and try to execute Load String procedure with load resource in there – Priler Aug 09 '13 at 22:45
  • 1
    If TChromium uses the Chrome browser engine, please be aware that it has a setting which allows or denies permission to load "local" files. However, this may not apply here because, IIRC, it pertains to file:// url's. – Marjan Venema Aug 10 '13 at 10:09
  • Where i can turn on this setting? – Priler Aug 10 '13 at 10:17

0 Answers0