This is a discussion on "[Tutorial] Print links in printable version using javascript" within the JavaScript Forum section. This forum, and the thread "[Tutorial] Print links in printable version using javascript are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[Tutorial] Print links in printable version using javascript
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
With screen media, one can easily link pages on the web(Eg:Click here to visit Google) . But when a user 'prints' the page, all your links will probably be lost or atleast won't print as you want them. To avoid this, it would be nice if we could somehow bundle the links with the printed matter. That is what I recently wanted for my website and I found that javascript could easily help me.
To see what I mean, see the below screenshot. It is a printable version of one the pages of my website. ![]() The logic is to extract hyperlinks from the body of print matter and list them seperately near the footer. To see a live example, click the "Print this page" link in bottom-right of this page. You would be shown as printer friendly format of that page with outbound links from the body-matter extracted and put in a seperate area. So how do we do that?Its simple 3 steps!
To get this method working, you need to have the TITLE attribut for every link in your matter. If you don't have, then you may decide to skip the title and only print the HREF attribute. Source: My Web development blog (originally written by me)
Last Blog Entry: Cross browser nuisance (Feb 11th, 2008)
Last edited by c010depunkk; Jan 18th, 2008 at 09:38. Reason: please use [HTML] tags when posting HTML |
|
|
|
||||
|
Re: [Tutorial] Print links in printable version using javascript
Wouldn't it be better to actually include the hyperlink in it's original context?
Something like :
That would save printing links down the bottom of the page.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: [Tutorial] Print links in printable version using javascript
Quote:
Last Blog Entry: Cross browser nuisance (Feb 11th, 2008)
|
|
||||
|
Re: [Tutorial] Print links in printable version using javascript
No it would write the text between the <a> tags and then in parenthesis would write the title of the link (if one exists) and the href.
say I had a link like this <a href="http://www.example.com" title="Example Website">Hello Rohan!</a> The printed page would read Hello Rohan! (Example Website : http://www.example.com)
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: [Tutorial] Print links in printable version using javascript
Quote:
Last Blog Entry: Cross browser nuisance (Feb 11th, 2008)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] Javascript tutorial | hegerp | JavaScript Forum | 2 | Nov 29th, 2007 13:31 |
| [Tutorial -> Trick] Link checking using JavaScript (ny myself) | RohanShenoy | JavaScript Forum | 7 | Nov 8th, 2007 12:52 |
| Newbie, Please help with javascript links | lea | JavaScript Forum | 1 | Nov 9th, 2006 14:45 |
| Detecting JRE version using javascript | Nagendra | JavaScript Forum | 0 | Sep 18th, 2006 05:08 |