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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:11:04+00:00 2026-05-23T07:11:04+00:00

I need to look at a href in a page and see if a

  • 0

I need to look at a href in a page and see if a certain bit of text is in the URL, if it is i need to change it to something else, then append a location to the end.

if the link contains “ice/app?service=page&page=probrowse”

ex: http://www.google.com/ice/app?service=page&page=probrowse&cat=1&year=2011

I need to change it to “club/probrowse.htm?”

ex: http://www.google.com/club/probrowse.htm?cat=1&year=2011

I am currently running the script below which takes into consideration ? and & in the URL and appending a location to the href.

<script type="text/javascript">
    jQuery(document).ready(function(){  
        jQuery('a').attr('href', function() {
                return (this.href.indexOf("?") >= 0) ? this.href + "&location=/abc/123" : this.href + "?location=/abc/123";
           });

    });
</script>

I ran into some other bumps due to the fact I am ingesting information from another site and need to make some minor URL changes.

The overall goal is to change

google.com/ice/app?service=page&page=probrowse&cat=1&year=2011

into

google.com/club/probrowse.htm?cat=1&year=2011&location=/abc/123

  • 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-23T07:11:05+00:00Added an answer on May 23, 2026 at 7:11 am

    I belive this is what you are looking for:

    <script type="text/javascript">
    jQuery.noConflict();
    jQuery(function(){
        var substr = 'ice/app?service=page&page=probrowse';
        var newstring = 'club/probrowse.htm?';
        jQuery("a").each(function(){
            if(this.href.indexOf(substr) != -1){
                var newHref = this.href;
                newHref = newHref.replace(substr, newstring);
                newHref += '&location=/abc/123';
                newHref = newHref.replace('?&','?');
                this.href = newHref;
            }
        });
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to convert $text = 'We had <i>fun</i>. Look at <a href=http://example.com>this photo</a>
I have a bash script. I need to look if text exists in the
What do I need to look at to see whether I'm on Windows or
I'm trying to do something similar to this: $('#dropdown1').change(function() { window.location = $(this).val(); });
I need to look up a value in a table where a table can
I need to look up all households with orders. I don't care about the
i need to look xsd file for generate code so i need this document
I sometimes need to look for information for a special portion of code. When
I have stored procedure in my database and i need to look up a
If it is possible, how does the parameter need to look like in the

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.