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 6635089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:00:28+00:00 2026-05-25T23:00:28+00:00

EDIT: I am not talking about the status bar display, I’m talking about the

  • 0

EDIT: I am not talking about the status bar display, I’m talking about the text you click on to follow the link. /EDIT

I looked through a few similar posts and didn’t find an answer. I have a link that I want displayed.

http://www.mylink.com

I want the href of the link to change every time the link is clicked.

href=”www.mylink.com?R=340978″

The query string changes to a random number after each click to prevent the browser from caching the page. It’s expected that the page will be changing frequently and be viewed frequently to assess those changes.

So I want people to see “www.mylink.com” but the link to lead to “www.mylink.com?R=34532” I thought I would achieve this with an onclick event that would apend a new random number and set the href attribute to the new link, however this is also changing the text that is displayed.

<script type="text/javascript">

var baseLink = "http://myDevLink/library/ea26098f-89d1-4305-9f75-afc7937f8336/25/test/036b602b-0bde-e011-957b-1cc1dee8bacd.html";
var link = "";

// Prime the link
$(document).ready(function() 
{
    NewRandomParam();
});

function NewRandomParam()
{
    // Make sure one of the warning messages isn't displayed instead of the link        
    if (document.getElementById("link") != null) 
    {
        // Add a random number param to the query string to prevent the user from opening a cached version of the page
        link = baseLink + "?R=" + Math.floor(Math.random() * 1000000);
        document.getElementById("link").setAttribute("href", link);
    }
}

</script>

<body>

<div id="divContent" style="display:inline; border:0px" class="tab">
<pre style="margin-top: 0;" >
<font face="tahoma">
<a href="" id="link" onclick=NewRandomParam(); target="_blank">http://myDevLink/library/ea26098f-89d1-4305-9f75-afc7937f8336/25/test/036b602b-0bde-e011-957b-1cc1dee8bacd.html</a>
</font>
</pre>
</div>

</body>
</html>

As you can see from the above code, there is no query string on what should be displayed however when I view the page the value of the href is displayed with the query string. If I do a view source the correct url is there and should be displayed but it isn’t.

Please enlighten me on where I’m being dumb.

  • 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-05-25T23:00:29+00:00Added an answer on May 25, 2026 at 11:00 pm

    The solution was a combination of things suggested here plus having to reset the links text to what I wanted it. Here is what worked.

    <script type="text/javascript">
    
    var baseLink = "<%= this.link %>";
    var link = "";
    
    $(document).ready(function () 
    {
        // Add a timestamp param to the query string to prevent the user from opening a cached version of the page
        $('#link').mouseenter(function () 
        {
            var date = new Date();
            link = baseLink + "?Timestamp=" + date.getTime();
            $("#link").attr("href", link);
            $("#link").text(baseLink);
        });
    
    });
    
    </script>
    

    Thanks to all of you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not talking about the themes we can easily import and edit the textpad
Note: I'm not talking about preventing the rebinding of a variable. I'm talking about
(I am not talking about Hibernate or NHibernate ORM ) Windows OS (and some
EDIT: It is not a listbox. My mistake. It is a list view. I
Edit: This is not a conflict on the theoretical level but a conflict on
Edit: It's not a bug as Martin pointed out. I'm just crossing the daylight
[edit] I am NOT using jquery in this app. Looking for a way to
[EDIT] I am NOT accepting any answer which involves BigInteger, or other similarly inefficient
edit: I'm not looking for you to debug this code. If you are familiar
LATER EDIT: Please mention not only game programming books, but also more scientific/simulation oriented

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.