Jump to content

Web Browser, отображение локальной страницы


Recommended Posts

Пользуюсь примером с Wiki, пытаясь отобразить локальную страницу, но безуспешно. Хотя уже с обычными страницами в сети всё в порядке. В чём могла бы быть проблема?

(Путь к странице правильный)

--In order to render the browser on the full screen, we need to know the dimensions. 
local screenWidth, screenHeight = guiGetScreenSize() 
  
--Let's create a new browser in remote mode. 
local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false) 
local browser = guiCreateBrowser(0, 0, screenWidth, screenHeight, false, false, false, window) 
  
-- The event onClientBrowserCreated will be triggered, after the browser has been initialized. 
-- After this event has been triggered, we will be able to load our URL 
local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser 
addEventHandler("onClientBrowserCreated", theBrowser,  
    function() 
        -- After the browser has been initialized, we can load [url=http://www.youtube.com]http://www.youtube.com[/url] 
        loadBrowserURL(source, "http://mta/goat/index.html") 
    end 
) 

Код страницы сначала пробовал этот:

<!DOCTYPE html> 
<html lang="pl"> 
    <head> 
        <meta charset="utf-8"> 
        <title>Witaj świecie!</title> 
    </head> 
    <body> 
        <h1>Witaj Danylo Kabanov!</h1> 
        <p>Witaj w laboratorium z Budowania Interfejsów Graficznych 
            Aplikacji Mobilnych! 
            To zalążek mojej pierwszej strony/aplikacji HTML5!</p> 
        <p>Program wyświetla prosty tekst bez formatowania.</p> 
        <img src="m1_t1.png"/> 
        <ul> 
            <li>A scary text under:</li> 
            <li>В переводчике нет информации</li> 
            <li>富栄</li> 
    </body> 

Потом этот:

  
<html> 
<header><title>This is title</title></header> 
<body> 
Hello world 
</body> 
</html> 
  

Edited by Guest
Link to comment
Если я не ошибаюсь, то чтобы отображать какие-то сторонние сайты или ссылки нужно сделать запрос на них с помощью
requestBrowserDomains 

Спасибо за ответ. Попробовал, но не помогло.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...