nurfaizfy19 Posted March 20, 2019 Share Posted March 20, 2019 Hello, sorry for my bad English I'm looking for a way to load a website in the game, for example a website that I have forum.javaliferoleplay.web.id I have a code like this function register_panel( ) local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 1280, 720 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 local window = guiCreateWindow( left, top, windowWidth, windowHeight , "Register", false ) local browser = guiCreateBrowser( 0, 28, windowWidth, windowHeight -60, false, false, false, window ) local theBrowser = guiGetBrowser( browser ) guiWindowSetSizable(window, false) requestBrowserDomains({ "forum.javaliferoleplay.web.id" }) addEventHandler( "onClientBrowserCreated", theBrowser, function( ) loadBrowserURL( source, "http://forum.javaliferoleplay.web.id/" ) end ) local close = guiCreateButton(0, 700, 1280, 50, "CLOSE", false, window) addEventHandler ( "onClientGUIClick", close, function() guiSetVisible(window, false) end ) end In the code above, the website I intended to load does not appear, but there is a dialog box asking for permission to open the link. But when opening youtube for example, the website opens normally. Can someone help me? Thanks before Link to comment
Addlibs Posted March 20, 2019 Share Posted March 20, 2019 This is because youtube.com is on the default whitelist. Clients must give permission to open addresses, so you need to requestBrowserDomains (as you have correctly done). However, you should use the callback argument in that function (or "onClientBrowserWhitelistChange" event) to know that the user gave permission and only then attempt to load the page. Trying to load it before permission has been granted won't load it. Link to comment
nurfaizfy19 Posted March 20, 2019 Author Share Posted March 20, 2019 Wow, amazing. It work fine. Thank you. One more, there are close button, when I or player click close button the window will destroyed or disappeared, but when I or player reopen the register_panel the browser can't load anything, how to reset the browsergui after click close button? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now