Jump to content

CEF Problem


Wumbaloo

Recommended Posts

Hey,

Today I would like to upgrade my code, for this, I need to use CEF.

But this not work, I downloaded exemples from internet and realized my own resource, my screen ingame is empty, no browser, anything.

Here's my index.html:

<!DOCTYPE html>
<html>
  <head>
    <title>Hello</title>
  </head>
  <body>
    Hey this is a little page just for testing CEF in MTA!
  </body>
</html>

 

Here's my meta.xml:

<meta>
	<info author="Wumbaloo" version="1.0" name="CEF" description="Test"/>
	<script src="cef.lua" type="client" />
	<file src="index.html"/>
</meta>

 

And this is my cef.lua:

local browser = guiCreateBrowser( 1920/2-1600/2, 1080/2-900/2, 1600, 900, false, false, false, window )
local theBrowser = guiGetBrowser( browser )

addEventHandler( "onClientBrowserCreated", theBrowser,
	function( )
		loadBrowserURL( source, "index.html" )
	end
)

 

Also tried with "loadBrowserURL(source, "http://mta/local/index.html") and rendered the browser in a "onClientRender" event

Edited by Wumbaloo
Link to comment

The documentation for guiCreateBrowser specifies the 5th argument "isLocal" is required to be set to true if the page you are loading is from a local file. You set this to false meaning you can only load public websites, not local files. Change this to true and it should work just fine.

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...