SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict jamus's Avatar
    Join Date
    Jul 2004
    Location
    Devon, UK
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    embedded javascript being printed?

    Hi,

    I have a page which when printed prints out the javascript from my analytics. Everything between the <script> tags.

    Javascript that is linked externally is not.

    through a process of elimination I have found it is the <base> tag the is causing it. When removed the javascript isn't printed.

    <base href="http://www.example.co.uk/" />


    Anyone know what might be causing this?

  2. #2
    Non-Member
    Join Date
    Jun 2010
    Location
    4727′35″N 2618′0″E
    Posts
    1,789
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    probably a start-tag end-tag error. have you validated your html?

  3. #3
    SitePoint Addict jamus's Avatar
    Join Date
    Jul 2004
    Location
    Devon, UK
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks noonnope,

    The HTML was valid. After some time trying to find the issue I eventually found the problem.

    The print stylesheet had the following
    Code:
    * { 
            display:inherit;
            width: auto;
    	height:auto;
    	float:none;
    	background-color:#fff;
    	border:none;
    	text-align:left;
    	}
    This display property was causing the issue. Now I need to work out

    1) if it should be causing the js to print
    2) out why it was there and
    3) if it is really required.

    Hope posting this helps someone else out.

  4. #4
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,276
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    Display: inherit on * looks wasteful and possibly a great way to introduce bugs (guess it depends on the display states set on all the elements, but I don't see why you'd even have to state that).

    And I must say I've never seen such a thing. I guess it's a succinct print stylesheet but it's gotta be a resource hog on the browser. That and I always view my pages with their print stylesheets squished down to 750 px or so because I like things printing out nicely.

    And I wonder if * really can override typical names in a stylesheet (I'm assuming you want to override the styles in the screen stylesheet? if you're not, why the float: none and width: auto stuff? Those are defaults).

  5. #5
    SitePoint Addict jamus's Avatar
    Join Date
    Jul 2004
    Location
    Devon, UK
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stomme poes View Post
    Display: inherit on * looks wasteful and possibly a great way to introduce bugs (guess it depends on the display states set on all the elements, but I don't see why you'd even have to state that).
    Tell me about it. Still, you live and learn. Valid points - thanks for your input.

  6. #6
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,276
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    Well in any case if removing it removes the bug then that should be ok: Print Preview should show the page looking the same either way.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •