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

  • Home
  • SEARCH
  • 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 7563615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:42:33+00:00 2026-05-30T13:42:33+00:00

I am using the following cut/paste function to get the URL parameters. function getUrlVars()

  • 0

I am using the following cut/paste function to get the URL parameters.

function getUrlVars() 
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    var i = 0;
    for(i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    
    return vars;
}

It works perfectly fine but when I get a URL like:

http://example.com/login.html?redirecturl=http://example.com/game_detail.html?id=3&reminderid=5

and I do something like:

loginVars = getUrlVars();
alert("redirecting to: "+loginVars['redirecturl']);

I get only:

redirecting to: http://example.com/game_detail.html?id

but what I want is the whole: http://example.com/game_detail.html?id=3&reminderid=5

  • 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-30T13:42:35+00:00Added an answer on May 30, 2026 at 1:42 pm

    As I said, in general you can not ‘guess’, especially when parameters (by RFC) belong to the original URL, not to the URL inside of one of those parameters, but in application to your example you can use

    var str = 'http://someurl.com/login.html?redirecturl='+                 
              'http://someurl.com/game_detail.html?id=3&reminderid=5', 
        separator = 'redirecturl=';
    
    alert(str.substring(str.indexOf(separator)+separator.length));​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code in rowdatabound function. Protected Sub gvwMileStone_RowDataBound(ByVal sender As System.Object,
I am using following PHP code for trigger creation but always get error, please
I am drawing a concave shape in canvas using the following code: var ctx
Currently for my blog I get a list of years/dates using the following code:
I am using the following query and utilizing the group_concat function. However, at times
In my codeigniter controller function I am using the following code to generate my
I am using following PHP code to connect to MS Access database: $odb_conn =
I am using following storedprocedure set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO Alter PROCEDURE
I'm using following peace of code to output an array: echo ======output without array_unique=====;
I am using following class to show a grid like appearance with pagination on

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.