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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:43:41+00:00 2026-06-01T17:43:41+00:00

I have a basic html page which is having a query parameter being passed

  • 0

I have a basic html page which is having a query parameter being passed to the page. I thought I would be able to get the value with Request.QueryString but the more reading I’m doing seems that this is only for asp applications. My html is as follows below

<body>
    <object type="application/pdf" width="100%" height="100%">
        <!--This didn't work-->
        <param name="src" value="<%=Request.QueryString["path"]%>" />
        <!--Neither did this-->
        <!--<param name="src" value="<%=Request.Params["path"]%>" />-->
        <!--When it is hardcoded then my page is displaying the pdf as expected.-->
        <!--<param name="src" value="scan.pdf" />-->
    </object>
</body>

I am calling the page with displayPdf.htm?path=scan.pdf

I’ve been searching for a way to access query parameters in html without having to write a javascript solution but haven’t had any luck. I’m sure adding a js function wouldn’t be too big a deal just thought I would avoid it if there was a single line approach.

Thanks for the help.

  • 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-06-01T17:43:42+00:00Added an answer on June 1, 2026 at 5:43 pm

    This cannot be done in pure HTML.

    This can be done in two ways, using JavaScript:

    <body><script>
    var param = /[&?]path=([^&]+)/.exec(location.search);
    param = param ? param[1].replace(/"/g, '&quot;') : '';
    document.write('<object type="application/pdf" width="100%" height="100%">\n' +
        '<param name="src" value="' + param + '" />\n</object>');
    </script></body>
    

    An alternative method is populating the parameter using DOM (demo: http://jsfiddle.net/N2GUf/2/):

    <body><object type="application/pdf" width="100%" height="100%">
        <param name="src" value="" id="param-path" />
    </object>
    <script>
    var param = /[&?]path=([^&]+)/.exec(location.search);
    if (param)
        document.getElementById('param-path').value = param[1];
    </script>​</body>
    

    In either case, the query string is read from the location.search property, and parsed using a simple regular expression.

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

Sidebar

Related Questions

This is for basic HTML/PHP pages, no query strings, etc.. I have searched high
I have a basic javascript question. In terms of performance, security, maintainability, which would
We have a simple ColdFusion page that is outputting basic HTML to the browser.
I have basic html stored in my database, which includes html such as the
I have a basic page which is used in an iFrame on an intranet
I have a page which uses a tag template. My web.xml is very basic.
Sorry about the wording for my question title. I have a basic HTML anchor
I have a very basic html, supposingly <html> <body> <iframe src=http://www.google.com> <p>Your browser does
Just a basic html link question. I have an intranet setup, and I need
This is probably a basic html/css question... I have a simple one-button form that

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.