Forum Moderators: phranque

Message Too Old, No Replies

rel='alternate' media='print' href

Opera can't open my alternate href link !

         

tomda

2:43 pm on Sep 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have in my index page, the following code :

<link rel='alternate' media='print' href='index.php?print=1>

so that anyone willing to print my index page will print a different layout of the page (remove banners, different header/footer, etc.)

Works great in Mozilla, IE, Netscape but NOT in Opera.

Is there any alternative I could use? @media?

PCInk

2:59 pm on Sep 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It isn't an alternative - it is your main css file (for that media).

So you should have:
<link rel="StyleSheet" href="style.css" type="text/css">
<link rel="StyleSheet" href="print.css" type="text/css" media="print">

Both are you MAIN css files for each type of media, so alternative css declarations are not needed. To view the print css file, you need to print the page or go to print preview.

encyclo

2:59 pm on Sep 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<link rel='alternate' media='print' href='index.php?print=1>

Is that a typo or are you really missing the end quote on the href? Also, why the single quotes (not that it should make a difference)?

tomda

5:32 am on Sep 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PCInk : I know that it is normally used for css (print/screen types) but as you can see below I call a different css file depending of the print value. I am the only one to do it this way? I use the print value so that I can remove banners, modify header and footer or add a onload print command when print=1, etc.


echo "<link rel='alternate' media='print' href='index.php?print=1'>";

if ($print=="1") {
echo "<link rel='stylesheet' type='text/css' href='".$url_root."style_print.css'><style type='text/css'>@import url(".$url_root."style_print.css);</style>";}

else {echo "<link rel='stylesheet' type='text/css' href='".$url_root."style.css'><style type='text/css'>@import url(".$url_root."style.css);</style>";}

Encyclo, you wrote :
YES, it is a typo error, sorry!
The single quote because it is generated with the echo of PHP. I was not aware that it could make a difference? Are you sure about that?

Still, the thing is that this method works great in all browsers I have but not in Opera. I have done some search in Google but found nothing interesting. Is there any other script I could use?

topr8

6:43 am on Sep 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>>>The single quote because it is generated with the echo of PHP. I was not aware that it could make a difference? Are you sure about that?

it doesn't, i use them interchangeably.