• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Checking URL? [SOLVED]

S

SheepDog123

Guest
Hello, I'm Henry.

I've just released my first game (made with gamemaker! :)) and, there's a small... problem. People are just embedding my game onto their site instead of purchasing a legal license from me. This, is not good.

Is there any way to check the url of the site that my HTML5 game is being played on? I have tried url_get_domain() but, that just gets the domain of the site that i'm hosting it on.. So, it would be nice, if I could check what url the game is being played on..

This is my first post, so be nice. :D

Thanks!!

- Henry
 

FrostyCat

Redemption Seeker
Create a JS file that contains the following:
Code:
function get_window_host() {
  return window.top.location.host;
}
Then create an extension, add that JS file to it, and add a function to it of the same name. Then you can do something like this from the GML side:
Code:
if (get_window_host() != "www.mysite.com") {
  room_goto(rm_invalid_host);
}
 
S

SheepDog123

Guest
Create a JS file that contains the following:
Code:
function get_window_host() {
  return window.top.location.host;
}
Then create an extension, add that JS file to it, and add a function to it of the same name. Then you can do something like this from the GML side:
Code:
if (get_window_host() != "www.mysite.com") {
  room_goto(rm_invalid_host);
}
Hi -- thanks so much for this..! Uh, one problem.. I know how do I set up the extension? I've never actually created an extension before, so this will be a good learning experience for me.. Thank you so much!

EDIT: I figured it out.. haha! No need to reply.. THANKS!!!
 
Last edited by a moderator:
Top