Html5 sitelock problem

Hi, did anyone have solution for sitelock html5 game?
I need get current ulr, in flash target is Lib.current.stage.loaderInfo but in html5 is undefined.
Best regards, Victor

you could use:

#if js
var url = untyped __js__("document.URL");
#end

that would get you the full url of the document where the game is loaded ( http://www.w3schools.com/jsref/prop_doc_url.asp )

Thank you!

This should be implemented now in the core:

:smile:

1 Like

Great. Thanks for solution.
I’m use document object too by:
js.Browser.location.hostname

Maybe we can also implement “root.loaderInfo.parameters” for HTML5 using the following haxe snippet:

   ////Source: http://bruce-lab.blogspot.com/2014/11/get-url-and-read-url-parameters-in.html 
   //translated from http://css-tricks.com/snippets/javascript/get-url-variables/
    function getQueryVariable(variable):String
    {
           var query:String = js.Browser.window.location.search.substring(1);
           var vars:Array<string> = query.split("&");
           for ( i in 0...vars.length) {
                   var pair:Array<string> = vars[i].split("=");
                   if(pair[0] == variable){return pair[1];}
           }
           return("null");
    }

Do you think that the parameters should be based on a GET string in the site URL, or do you think that it should be based on an embed value, like you have in SWFObject for Flash?

If I wanted access to the URL parameters in HTML5, I’d want access in Flash too. I’d have to parse the URL myself regardless of which one you chose.