Jump to content

Browser Issues


benwilkins

Recommended Posts

 

function toggle ()

	local screenWidth, screenHeight = guiGetScreenSize( )
	local window = guiCreateWindow( 0, 0, screenWidth/1.2, screenHeight/1.2, "Mobile Data Computer", false )
	
	exports.global:centerWindow(window)
	guiSetInputEnabled(not guiGetInputEnabled())
	guiWindowSetSizable ( window, false )
	guiSetAlpha( window, 255)
	
	local browser = guiCreateBrowser( 0, 28, screenWidth/1.2, screenHeight/1.35, false, false, false, window )
	local theBrowser = guiGetBrowser( browser )
	local closeButton = guiCreateButton( 0, (screenHeight/1.35)+40, screenWidth/1.2, 50, "Close Mobile Data Computer", false, window )
	
	addEventHandler("onClientGUIClick", closeButton, 
						function () 
							destroyElement(window)
							destroyElement(browser)
							destroyElement(theBrowser)
							destroyElement(closeButton)
							window = nil
							browser = nil
							theBrowser = nil
							guiSetInputEnabled(not guiGetInputEnabled())
						end)
						
						
	addEventHandler( "onClientBrowserCreated", theBrowser, 
		function( )
			loadBrowserURL( source, "http://facebook.com" )
		end
	)
	
end
addCommandHandler("callmdc", toggle )

addEventHandler("onClientResourceStart", getResourceRootElement(),
    function() 
        requestBrowserDomains({"http://facebook.com"}) 
    end 
) 

 

This code works fine sometimes, when I do it, its fine, but for everyone else, it just shows the GUI window, with no browser inside. No errors in debug.

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