Create a redirect button using URL parameters


I work in Marketing and my HTML and Javascript knowledge is not that good. I use Hype because it allows me to design visually and then export to HTML5 that I can publish in our websites and product tutorials.

Right now I have an issue. I need to build a little launcher page with two buttons. The second button will be used to direct users to their own personal page. I have built the page in Hype and saved it with a name (i.e. redirect.html) What I need is that when I invoke that page using an url like this:
h t t p : / /

Then the button I have built, when pressed, will take the user to another website (in a new window) like this:
h t t p : / /

Where the users_name and user_token are the ones harvested from the URL where I stored my hype page. That is, for a username of and token=abcdefg I would invoke my Hype page going to:
h t t p : / /

And the button that I placed on it, when clicked, would open a new window and point it to something like:
h t t p : / /

Yes, the redirected page needs to use username twice, I didn’t set that requirement, I have to live with it.

I have found on the Internet how to harvest parameters from a web URL and how to build a destination URL from them, however, I don’t know where to place this code on Hype, and I don’t know how to make the button call that built URL when I click on it (probably running a javascript function, I guess). Any charitable soul want to illuminate me?

Thanks a million in advance!!!

Can you post the code you have…

This is what I have to harvest parameters from a URL:
var user_name = getParameterByName(“username”);
var user_token = getParameterByName(“token”);
var rootUrl = “”;
var myURL = rootUrl + user_name + ‘?username=’ + user_name + ‘&token=’ + user_token;

That would build a variable called myURL with the new URL. But I don’t know how to have a button open a new blank window and point it to that URL. And also, I don’t know where to implement this function above (I would have to give it a name too) if I should run it automatically at the scene load, and if myURL var will actually survive outside of the function or will be valid only within the function (keep in mind that my knowledge of Javascript is limited, the last time I ever coded something was using C++ about 13 years ago).


Can nobody help me here? nobody from Tumult can tell me how to do this?

Hi Carlos

Sorry nobody has replied for a while.

I will attempt to shed some light on this for you

declare your variable without the "var" so this will make it accessible outside your function.

but I would just run this "new function" as a click event on your button

var user_name = "Carlos";
var user_token = "46858ye87h38";
var rootUrl = "";
var myUrl = rootUrl + user_name + '?username=' + user_name + '&token=' + user_token;, "_blank");

Hope this helps!