How do I hide a button from external javascript

0 favourites
  • 6 posts
From the Asset Store
J-BoB Game Button Sound Pack comes with 300 high-quality sound effects
  • Hello together

    I have a javascript which should show a button. Only when user ist set the button should be shown.

      var url = document.URL;
      var user = url.split("&user=");
      if(user != "") {
      user = user[1].split("&");
      if(user[0] != "NOUSER" && user[0] != "") {
      // Show Button
    So now my question is how can I add this function to Construct 2, so that a button is set to invisible.
  • Using the "Button set invisible" action?

    Actually if you want the button invisible on start you could choose to set it invisible in it's properties and only set it visible when needed, or create the button object when needed using a system create action.

    I'm not sure why you would want to use an external script for that..

  • Ok and how can I check if the user variable is set in Construct2?

  • System compare variable User is not ""

    You might want to look at some tutorials and read the manual..

  • But I don't have the variable in Construct 2. it's only a browser url parameter

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Through the browser object you can get all the info you want..


    The current HTML document's title.


    The current domain, e.g.


    The string after the hash at the end of the URL, including the hash. For example, if the current URL is, this returns #teapot.


    The path relative to the domain in the URL. For example the path name of is /mygame/index.html.


    The current protocol, usually either http: or https:.


    Return a query string parameter by name. For example, if the URL ends with index.html?foo=bar&baz=wan, QueryParam("foo") returns bar and QueryParam("baz") returns wan.


    Return the full URL query string including the question mark. For example, if the URL ends with index.html?foo=bar&baz=wan, this returns ?foo=bar&baz=wan.


    Get the previous page that linked to this page, if any.


    Get the complete current URL in the browser address bar, including the protocol.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)