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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:10:12+00:00 2026-05-16T23:10:12+00:00

I have two HTML pages, example1.html and example2.html . How do I pass variables

  • 0

I have two HTML pages, example1.html and example2.html.

How do I pass variables from example1.html to example2.html using the query string, and retrieve that variable in example2.html without using any serverside code?

  • 1 1 Answer
  • 1 View
  • 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-16T23:10:12+00:00Added an answer on May 16, 2026 at 11:10 pm

    In example1.html:

    <a href='example2.html?myVar1=42'>a link</a>
    <a href='example2.html?myVar1=43'>another link</a>
    

    or generate the links with Javascript as desired. Just make sure the ?varName=value gets onto the end of example2.html somehow.

    Then, in example2.html, you use Javascript to parse the query string that example2 came with.

    To do this, you could try Querystring.

    // Adapted from examples on the Querystring homepage.
    var qs = new Querystring();
    var v1 = qs.get("myVar1");
    

    Alternatively, parent.document.URL contains the complete URI for the page you’re on. You could extract that:

    parent.document.URL.substring(parent.document.URL.indexOf('?'), parent.document.URL.length);
    

    and parse it manually to pull the variables you encoded into the URI.

    EDIT: Forgot the ‘new’ part of ‘new Querystring()’. Oops…

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

Sidebar

Related Questions

I have two html pages example1.html and example2.html ,how can i pass a javascript
I have a simple jQueryMobile index.html page. Within that I have two pages using
I have two pages - a simple HTML code example page from a jQuery
I have two html pages on my webserver www.example.com/desktop.html www.example.com/mobile.html In principle the content
lets say i have two pages links.html & contents.php ... first page contains only
Lets say there are two pages with two different html elements which have the
I have the exact same html sitting on two different servers. Both pages call
I have to check the differences between two html pages: One is an old
I have a document that was converted from PDF to HTML for use on
I have an application with two html files: app/page1.html app/page2.html These pages share dependencies,

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.