Hey guys and girls.
I was wondering if it was possible to open a URL in the computer's default web browser from my LOVE game.
I am trying to make a Help button and I want it to open http://myurl.com/game/help.aspx.
Thanks!
Opening a Web Browser from LOVE
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Opening a Web Browser from LOVE
I was looking around Stack Overflow and found this(it might help you)
http://stackoverflow.com/questions/1116 ... -extension (Found kikito with an answer, ironically)
http://stackoverflow.com/questions/2950 ... lua-script (To find what OS lua is being hosted on)
You would have to find the OS the user is on, then execute the system-specific command to open that url with the default browser.
Use os.execute([command]) to execute the OS-specific command.
http://stackoverflow.com/questions/1116 ... -extension (Found kikito with an answer, ironically)
http://stackoverflow.com/questions/2950 ... lua-script (To find what OS lua is being hosted on)
You would have to find the OS the user is on, then execute the system-specific command to open that url with the default browser.
Use os.execute([command]) to execute the OS-specific command.
Re: Opening a Web Browser from LOVE
Thanks.
Works perfect.
Works perfect.
- slime
- Solid Snayke
- Posts: 3162
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Opening a Web Browser from LOVE
love._os is a string containing either "OS X", "Windows", or "Linux" currently.
Re: Opening a Web Browser from LOVE
Thanks, slime.
That will help a lot in the next month or so.
That will help a lot in the next month or so.
Re: Opening a Web Browser from LOVE
Okay, I can use os.execute to open a web page.blenderer wrote:I was looking around Stack Overflow and found this(it might help you)
http://stackoverflow.com/questions/1116 ... -extension (Found kikito with an answer, ironically)
http://stackoverflow.com/questions/2950 ... lua-script (To find what OS lua is being hosted on)
You would have to find the OS the user is on, then execute the system-specific command to open that url with the default browser.
Use os.execute([command]) to execute the OS-specific command.
However, when I add GET fields (?f1=v1&f2=v2) it removes them.
Any way to stop this? I need to allow GET fields for my game to work.
Re: Opening a Web Browser from LOVE
On Windows, you can use a ^ to escape an &, so
opens this thread!
Code: Select all
os.execute('start https://love2d.org/forums/posting.php?mode=reply^&f=4^&t=9930')
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Opening a Web Browser from LOVE
Are you surrounding the address by "double quotes"?
Help us help you: attach a .love.
Re: Opening a Web Browser from LOVE
Ahhaha! I am an idiot!Robin wrote:Are you surrounding the address by "double quotes"?
Sorry, and thanks!
Re: Opening a Web Browser from LOVE
Okay, it opens up a CMD window with that URL as the title now...Robin wrote:Are you surrounding the address by "double quotes"?
is that normal? lol
Who is online
Users browsing this forum: Ahrefs [Bot] and 4 guests