Javascript Window.Print() doesn't return to URL with Querystring attached

I have a simple button on my web page that does onclick="window.print();" and it works well.  However when the print is completed and the view is returned to the page, there is no Querystring after the URL.  It just says "http://myweb/rego.asp?" rather than "http://myweb/rego.asp?eid=55".

Some help would be wonderful.
DClarkeNZAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RobOwner (Aidellio)Commented:
is it a button or link element you're using to trigger the print?  Can you please post the html you're using to trigger it.  If you are using an anchor <a> element then you'll need the href="#"
0
DClarkeNZAuthor Commented:
  <button onClick="window.print();">Print</button>

Open in new window


Current page URL is "https://mysite.com/registrations/MYC_Reports9awai.asp?eid=55"

When it returns to page it seams to refresh with "https://mysite.com/registrations/MYC_Reports9awai.asp?"
0
RobOwner (Aidellio)Commented:
There's more than meets the eye on this one as I can't replicate your issue: http://jsbin.com/xurene.html?eid=55 with code http://jsbin.com/xurene/3/edit?html,output
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

DClarkeNZAuthor Commented:
Your pages are html pages whereas mine as classic asp.  I'm wondering whether asp pages do a 'refresh' once the print function is finished (or cancelled).  So I checked to make sure there was no 'onload' functions or the like or any javascript that might be affecting this.  All I could find is the following piece of code at the bottom of my <head> section.  I'm not sure why it's there or what it is achieving.

<script>
//Page Highlighting
var url = window.location.toString()
$(document).ready(function(){
  $('ul li a').each(function(){
    var myHref= $(this).attr('href');
    if( url.match( myHref )){
      $(this).addClass('active');
    }
  });
});
</script>

Open in new window

0
RobOwner (Aidellio)Commented:
All that you've mentioned shouldn't affect the issue you're having.  I'm not an asp dev but I am aware of partial postbacks.
Can you post the link to your site or send me a private message with the link to the page? I'll get a better idea with that
0
Michel PlungjanIT ExpertCommented:
It is possible the button is submitting to current page.

Try

  <button onClick="window.print(); return false">Print</button>

which is what you also would do on a link
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RobOwner (Aidellio)Commented:
Michel, I think you're on the money with that one.
Try changing your button to a link as confirmation of what Michel is saying. A link should give you the desired effect.
I do remember that a button within a form will submit it when the type is omitted (as Michel had indicated in his post)
0
DClarkeNZAuthor Commented:
Perfect!  I suspected a return parameter but had tried 'True' instead of 'False'.  Duh - makes sense now thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.