This question is mostly out of academic interests(and partly because I faced an issue like this before and simply found a workaround, but I want to know the proper way to do it).
How does the window.print() JavaScript function decide which parts of a page to print? My end goal is to add new fields to the 'print' dialog which is not there in the original page and also be able to prevent some content in my page from being printed(for eg: prevent some plaintext links on my webpage being printed onto paper).
Can I edit the function to suit my requirements? Where are the JS files located?