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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:31:24+00:00 2026-05-23T10:31:24+00:00

How do i set a page to append a urlVariable into its links? for

  • 0

How do i set a page to append a urlVariable into its links?

for example, i have 3 different pages and all are linked into the same page, e.g.
receiver.html

first page link:

receiver.html?sender=1

second page link:

receiver.html?sender=2

third page link:

receiver.html?sender=3

when the first page is clicked it will send the user to receiver.html which has many outgoinglinks inside, and the script will append the variable into all its outgoing links depending on the three pages above?

receiver.html

outgoinglink.html?sender=1
outgoinglink2.html?sender=1
outgoinglink3.html?sender=1

and if second page is used, the receiver.html will append

?sender=2

on all its link inside and so on and so forth..

  • 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-23T10:31:24+00:00Added an answer on May 23, 2026 at 10:31 am

    Well you could use the function shown in this post (http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript) to get your parameter

    function getParameterByName( name )
    
        {
          name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
          var regexS = "[\\?&]"+name+"=([^&#]*)";
          var regex = new RegExp( regexS );
          var results = regex.exec( window.location.href );
          if( results == null )
            return "";
          else
            return decodeURIComponent(results[1].replace(/\+/g, " "));
        }
    
    var sender = getParameterByName('sender');
    

    then attach what you need to all href:

    $('a').each(function(){
        var href = $(this).attr('href');
        if (href.indexOf('&') !== -1){
            //if you have on & in the href you must use &
            $(this).attr('href', href+'&sender='+sender);
         }else{
            $(this).attr('href', href+'?sender='+sender);
         }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page containing a set of jQuery tabs. All the tabs point
I have a custom error page set up for my application: <customErrors mode=On defaultRedirect=~/errors/GeneralError.aspx
I'm trying to set a page that displays the visitor's IP. All the methods
I recently discovered that when you have a page set to session readonly and
For while I have been trying to set the Page Scaling of Excel page
I have a button on a page with an onClick I dynamically set via
I have set of xml elements like this: <item code=<HTML_CODE> /> For example: <items>
I have a bunch of links on a page that on an action, I
I have some jQuery tabs set up on the right of the page, however
So after a huge headache, I got my site to load its pages all

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.