Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlink with two javascript functions

Status
Not open for further replies.

jas1950

Technical User
Dec 6, 2009
1
CA
Hi

I am new to programming javascript but slowly catching on.

I have the following hyperlink which works:

<a href='javascript:document.location.href=DeObfuscate("d0ccccc8829797cfcfcf96cfdddacbd1ccddc8cad7ccdddbccd1d7d696d6ddcc")'>Go To: WPAS</a>

The above is bascially an obfuscated link to a website which works.

When the user clicks on the link, he goes to the website in question. Now if he wants to go back to the previous page he would use his browser back button. This is what I want to stop. That is, prevent writing to the browser history to prevent back button operation.

Now I found the following javascript which does just that as follows:

<script type="text/javascript" language="JavaScript"><!--
function To(url) {
location.replace(url);
}
//--></script>

My hyperlink would then be as follows when using a regular link.

<a href="javascript:To('
Again this link works perfecttly

Here comes the fun part.
What I want to do is use both javascript functions into one hyperlink so that not only is it obfuscated but also will not write to the browser history.

This is what I have done using the obfuscated link:

<a href="javascript:To('javascript:document.location.href=DeObfuscate("d0ccccc8829797cfcfcf96cfdddacbd1ccddc8cad7ccdddbccd1d7d696d6ddcc");')">Test Link</a>

As I mentioned before, both links work great separately, but not when I try to combine both functions. I get an error and nothing happens.

Is it possible what I am asking. Is there some small mistake I am making when I combine them.

I would really appreciate some advise on this

Thanks
 
Have you tried....

<a href='whatever' onclick='To'>Test Link</a>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top