Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2003
    Location
    Pittsburgh
    Posts
    3,479

    Possible to get number of pixels on a web document?

    Bear with me guys - I'm not a web developer. Is it possible to get the number of pixels a web page takes up? I'm trying to look at the number and size of ads (in pixels) and comparing it against the total size of the document (again in pixels) to see how much of the site is taken up by advertisements.

    Thanks!

  2. #2

  3. #3
    Join Date
    Aug 2003
    Location
    Pittsburgh
    Posts
    3,479
    Thanks for that... I'll have to look into it more.

    I'm not exactly sure if what I'm asking is even possible. I was just hoping there was a JavaScript function that would return the pixelated size of the page on the current display (I know it would depend on the user's resolution, but still).

  4. #4
    Join Date
    Oct 2004
    Location
    Shimonoseki
    Posts
    2,101
    There is also MeasureIt for Firefox.
    Closed for winter...

  5. #5
    Join Date
    Nov 2002
    Location
    paradise
    Posts
    6,201
    Quote Originally Posted by CArmstrong View Post
    Bear with me guys - I'm not a web developer. Is it possible to get the number of pixels a web page takes up? I'm trying to look at the number and size of ads (in pixels) and comparing it against the total size of the document (again in pixels) to see how much of the site is taken up by advertisements.

    Thanks!
    The ad banner sizes are mostly standardized.

    See here for size reference: http://www.bannercreator.nu/banner-size.html

    So I suppose you can take a screenshot and deduct the ad banners from the total pixel in the screenshot of the webpage.

  6. #6
    Join Date
    Aug 2003
    Location
    Pittsburgh
    Posts
    3,479
    Thanks for the links, guys. I know the pixel side of the ad. What I'm trying to do is get the total pixel "area" of the whole page so that I can see how much of the page is taken up by ads. Does that make sense? I'm trying to get a percentage that tells me how much of a page is covered by ads. Thanks again!

  7. #7
    Join Date
    Sep 2005
    Location
    San Diego, California
    Posts
    865
    You may want to try something like this using JavaScript...
    Code:
    <script type="text/javascript">
    function getBodyPx(){
    	var scnW,scnH,tot;
    	if (self.innerHeight) // except IE
    	{
    		scnW = self.innerWidth;
    		scnH = self.innerHeight;
    	}
    	else if (document.documentElement && document.documentElement.clientHeight)
    		// Special IE
    	{
    		scnW = document.documentElement.clientWidth;
    		scnH = document.documentElement.clientHeight;
    	}
    	else if (document.body) // other browsers
    	{
    		scnW = document.body.clientWidth;
    		scnH = document.body.clientHeight;
    	}
    
            //multiple Width by Height to get total dimensions...
    
            tot = scnW*scnH;
            return tot;
    }
    
    pxs=getBodyPx();
    adpx=80*120; //set the area for a 80 X 120px ad...
    
    percent_calc=Math.round((adpx/pxs*100))+"%";
    alert("Ads cover "+percent_calc+" of the page.");
    </script>
    Is this what you were looking for?
    Othio Hosting - Private-Label cPanel Reseller Hosting
    True 24x7 Support | SSD Storage | cPanel+WHM | R1Soft Backups

Posting Permissions

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