check url
Monkey Targets Forums/HTML5/check url
| ||
How to check which url the app is running? |
| ||
How do you check what the URL of the page is? You can quickly get the server's domain with document.domain or the URL with document.URL using the DOM module... That's one way anyway. |
| ||
|
| ||
This is a more platform-agnostic way to do it: Obviously this should be filled in with code for Flash. function (){return ExternalInterface.call(~qwindow.location.href.toString~q);} But this requires ExternalInterface to be imported. -------------------- Edit: GetCurrentURL() added to Diddy r321 for HTML and Flash. |
| ||
Extern Function getCurrentURL:String() = "function (){return document.URL;}" Public That gives me an error: Missing return expression. |
| ||
That gives me an error: Missing return expression. Strange... that works fine here. What version of Monkey are you using? Try just copying and pasting impixi's example: Strict Extern Function getCurrentURL:String() = "function (){return document.URL;}" Public Function Main:Int() Print getCurrentURL() Return 0 End |
| ||
Is that error in Monkey or in the browser? If it's a Monkey error, you may have forgotten the Return 0 statement in the Main function. Strict mode requires it. |