Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8909025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:19:58+00:00 2026-06-15T03:19:58+00:00

<a onclick=dataBounce(‘http://yahoo.com’); href=http://google.com>Yahoo? :-/</a> <script> function dataBounce(dest) { // Note: dest is assumed to

  • 0
<a onclick="dataBounce('http://yahoo.com');" href="http://google.com">Yahoo? :-/</a>

<script>
function dataBounce(dest) 
{
  // Note: dest is assumed to be encodeURI()ed. 
  var ie = !-[1,];

  var bouncer = 'data:text/html;charset=utf-8,%3C%21doctype%20html%3E%3Cscript%3Ewindow.location%20%3D%20%27'+ dest +'%27%3B%3C/script%3E';
  console.log('bouncer: ' + bouncer);
  window.location = !ie ? bouncer : dest;
  return false;
}
</script>

Yeah, the href is to google, but I have an onclick handler hijacking the click on the link, to navigate to a data URI which bounces the window‘s location to yahoo. However, when I click the link, I’m still taken to google. Why?

Why do I want to do this? It’s partly just an experiment, and partly something I’d like to use in practice to protect users’ privacy: by creating an intermediate bouncer page, the referrer is shielded from the destination server.

Here’s the link:

http://jsbin.com/efaful/1

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:19:59+00:00Added an answer on June 15, 2026 at 3:19 am

    Because you need to return false after doing anything in the onclick to prevent the default behaviour of the link.

    <a href="http://google.com" onclick="dataBounce('http://yahoo.com'); return false;" />link</a>
    

    Or have your dataBounce function return false and:

    <a href="http://google.com" onclick="return dataBounce('http://yahoo.com');" />link</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a onclick function like this onclick = function(){alert('hello')} I want to add
I have an onclick function that I want to add an anchor to the
I wrote function onclick of a element <div class=left_collapsed>Որոնում</div> <div class=container style=display: none;> <ul>
I try to make example with datatable of YUI-2.8.2. YAHOO.example.DynamicData = function() { //
ProgressDialog onClick not working.. here is my code .. Basically i want to show
I have an onClick like this: public void onClick(View v) { updateTable(v.getId()); //All ID's
I have a onclick event that is like: public void OnMyButton_Click(object sender, EventArgs e)
how to handle button onclick action in iPhone without using interface builder?
In the below code onclick edit how can the value of tag test be
I want to capture onClick events for the trackball on a HTC Hero. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.