What's My URL?

Monkey Targets Forums/HTML5/What's My URL?

ElectricBoogaloo(Posted 2014) [#1]
I've not even bothered to look into this yet, but thought I'd ask incase there's an easy answer.

Today I FINALLY upgraded my server (AGameAWeek.com/Socoder.net) and finally have the ability to start adding fun little server-based bits and pieces, but HTML and Flash both require "Same Server" communication, so if I want to do anything really fun without crashing the game, I'm going to have to be able to grab the browser's current address. Then if the game's on my server, do my server stuff. If the game's on GameJolt, use their tidbits.. And if it's anywhere else, disable funstuffs.

So, I'm wondering if there's a quick and easy "Address bar's content"/"Current server" method that works with bog-standard Monkey. Thanks for any input.


skid(Posted 2014) [#2]
#If TARGET="html5"
Import dom
Function ServerName$()
	Return window.location.hostname
End
#Else



ElectricBoogaloo(Posted 2014) [#3]
Thanks.
Having spent about 24 hours playing with a server, fixing apostrophe issues, and generally tearing my hair out, it seems my mind was completely fried by that point!!