URL query string parameters

Hi there,
Can anyone show me the proper way to pass URL Query Parameters to my game’script in cocos creator?
For example:
http://www.exmaples.com/?id=“abcd”
What is the proper way to pass the id variables to my game’s scripts.

Take a look at http://stackoverflow.com/questions/814613/how-to-read-get-data-from-a-url-using-javascript

1 Like

Did this work? window.location.href is not a valid cocos command right?

For web, it will work.