Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
502 views
in Themes by
edited by

I am trying to implement features for SSO site to make it not so different from the old one. 

'buttons' => array(
     'account' => array(
              'tags' => 'onClick="qa_edit_profile()"',
              'label' => qa_html("Edit Profile") ,
      ) ,
) ,

As you can see, the onClick event will call the qa_edit_profile() function which I has written in qa-content\qa-page.js file:

function qa_edit_profile()
{
     location.href = "www.yoursite.com";
}

But when I click, it doesn't work. While other function works like alert(),...

So the question is, is there any solution to make the browser redirect to an URL when click on a button?

1 Answer

+1 vote
by

"But when I click, it doesn't work." -> What happens exactly? Are you getting a "qa_edit_profile() function not found"? Are you getting redirected to the wrong URL?

Check if this works:

onclick="window.location='http://www.yoursite.com'"

If it does, add it to the function and check if it works.

If it does, most likely you were just missing the protocol in the redirect string.

...