artem_niko Posted April 23 Posted April 23 Hello! How I can show standart, any html page (can use images) in UniGUI? I have one html web page (for example: http://myhtml.html) and I want show this page to user, maybe using UniHTMLFrame, not in browser, in my project. Quote
Sherzod Posted April 23 Posted April 23 Hello, Yes, you can do this inside your UniGUI app without opening an external browser. You actually have two different components depending on what exactly you want to show: 1. UniURLFrame — for displaying an external page by URL (this is probably what you want): UniURLFrame1.URL := 'http://example.com/mypage.html'; Internally it uses an <iframe>, so images, CSS and JS from that page work normally. 2. UniHTMLFrame — for injecting raw HTML content that you generate or load yourself: UniHTMLFrame1.HTML.LoadFromFile('C:\path\to\myhtml.html'); // or UniHTMLFrame1.HTML.Text := '<h1>Hello</h1><img src="files/pic.png">'; Rule of thumb: got a URL → UniURLFrame. Got HTML text/file → UniHTMLFrame. Important caveat for both: many modern sites (Google, YouTube, Facebook, most banking sites, etc.) send an X-Frame-Options: DENY/SAMEORIGIN header or a Content-Security-Policy: frame-ancestors directive, which tells the browser to refuse rendering inside a frame. You'll just get a blank area — and it can't be bypassed from the client side, that's a security feature against clickjacking. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.