tommymaster Posted February 11, 2018 Share Posted February 11, 2018 (edited) Hi! This is my code: window = guiCreateWindow(0, 0, 500, 500, "News", false) browser = guiCreateBrowser (0, 10, 500, 500, true, false, false, window) theBrowser = guiGetBrowser (browser) loadBrowserURL (theBrowser, "http://localhost/index.html") This is inside a clientsided function what gets triggered from server size. The window called "News" is getting displayed, but the index.html file of my local host won't. I am using XAMPP, and the file index.html exists, and i can view it in Google Chrome, by setting the URL to "http://localhost/index.html". What may the problem be, could you please help? I want to set up an easy HTML page, and by clicking onto texts it will redirect me to an other HTML file, and if possible, change these files without restarting the resource. Is this possible here? Edited February 11, 2018 by tommymaster Link to comment
Tails Posted February 12, 2018 Share Posted February 12, 2018 (edited) You're setting the URL too fast. Use the browser events. You'll need to use this one: https://wiki.multitheftauto.com/wiki/OnClientBrowserCreated Edited February 12, 2018 by Tails 1 Link to comment
tommymaster Posted February 12, 2018 Author Share Posted February 12, 2018 (edited) --this gets triggered from server side: local window = guiCreateWindow(0, 0, 500, 500, "News", false) local browser = guiCreateBrowser (0, 10, 500, 500, true, false, false, window) local theBrowser = guiGetBrowser (browser) addEventHandler ("onClientBrowserCreated", theBrowser, setURL) --end of function function setURL() loadBrowserURL (source, "http://localhost/index.html") end Still it does not work. Edited February 12, 2018 by tommymaster Link to comment
Tails Posted February 12, 2018 Share Posted February 12, 2018 (edited) Try youtube.com or mtasa.com which should work without requesting the domains Else try adding port 80 after localhost like "localhost:80/index.html" Edited February 12, 2018 by Tails Link to comment
tommymaster Posted February 12, 2018 Author Share Posted February 12, 2018 it is not giving any error. the function gets defined way before it would trigger the function that contains addEventHandler Link to comment
Tails Posted February 12, 2018 Share Posted February 12, 2018 Edited my post didn't read the comments in the code Link to comment
tommymaster Posted February 12, 2018 Author Share Posted February 12, 2018 and how should i do that? Link to comment
Tails Posted February 12, 2018 Share Posted February 12, 2018 Just change the address in loadBrowserURL 1 Link to comment
tommymaster Posted February 12, 2018 Author Share Posted February 12, 2018 sorry, it was still displaying your old comment, i'll try it. it is still not working. even if i try switching isLocal to true. 1 Link to comment
Tails Posted February 12, 2018 Share Posted February 12, 2018 (edited) Set isLocal to false when you're loading the localhost This worked fine with my server local browser = guiCreateBrowser (0, 10, 500, 500, false, false, false) local theBrowser = guiGetBrowser (browser) function setURL() loadBrowserURL (source, "http://localhost:3000") end addEventHandler ("onClientBrowserCreated", theBrowser, setURL) Edited February 12, 2018 by Tails 1 Link to comment
tommymaster Posted February 12, 2018 Author Share Posted February 12, 2018 (edited) thanks!! Edited February 12, 2018 by tommymaster 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