![Firefox logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2020-04-14-08-36-13-8dda6f.png)
Pictures don't always print in webpages
In particular, when I print an article from the New York Times, (nytimes.com) the article prints without pictures. I've played around with the settings, with no luck. Does anyone have any suggestions?
被選擇的解決方法
paul459 said
Thank you! Next time I run into the problem on another site I'll post the link. Should I mark this post as solved, or keep it open for the next time?
It's probably best to mark it solved. That way the forum will allow it to be indexed by Google and it could help others with the same question.
從原來的回覆中察看解決方案 👍 0所有回覆 (15)
Sometimes this is how the page is designed: one set of layout rules for the screen and a different set of layout rules for printing. If you post a link to a specific article where you see the pictures in regular viewing but they are gone in Print Preview, another volunteer should be able to tell you whether they get the same layout.
Here is the link you asked for:
This doesn't print with pictures. Seems to do it in Google Chrome also. I read something about print style sheets that make it do this.
Are there plugins or addons that can save/print the page with pictures?
You can inject a new style rule into the page to override the rule hiding the images. Not very convenient, and probably different from site to site, and may be obsoleted by changes on the NYTimes site, but here's a script to do that at the moment:
var s=document.createElement("style"); s.appendChild(document.createTextNode("@media all{#story .media, #story .photo, #story .image{display:block !important;}}")); document.body.appendChild(s);
You can run that script against the current page by pasting it into the Web Console (command line at the bottom) and pressing Enter to run it, or save it as a bookmarklet, which is a script saved to your Bookmarks Toolbar or Bookmarks Menu for one-click operation. If you need to override this rule often, that's probably easiest. Here's how:
One-time Setup:
(A) Select and copy the following script:
javascript:var s=document.createElement("style"); s.appendChild(document.createTextNode("@media all{#story .media, #story .photo, #story .image{display:block !important;}}")); document.body.appendChild(s); void 0;
(B) Right-click a spot on the Bookmarks Menu or Bookmarks Toolbar where you would like to save the script and choose New Bookmark
(C) In the Location box, paste the script, then in the Name box, enter something you'll remember like NYTPrint and click the Add button
To use the bookmarklet:
While viewing the page that needs modification, click the bookmarklet button. You should see the images in Print Preview.
Thank you for your reply and script. I can't test it because I've reached my limit of articles for the month. Somehow the nytimes can track how many articles per month. I imagine this is done by a cookie. Any suggestions on how I can find and delete this cookie?
Cookies are easy to delete on a site by site basis. While viewing a page on the site, try either:
- right-click (on Mac Ctrl+click) a blank area of the page and choose View Page Info > Security > "View Cookies"
- (menu bar) Tools > Page Info > Security > "View Cookies"
- click the padlock or "i" icon in the address bar, then the ">" button, then More Information, and finally the "View Cookies" button
In the dialog that opens, the current site should be pre-filled in the search box at the top of the dialog so you can remove that site's cookies individually.
If you can't get on the site with current cookies, open the dialog on a different page and edit the domain listed in the box at the top to the base site address, e.g., nytimes.com to list that site's cookies.
Then try reloading the page. Does that help?
I found and deleted all the cookies for nytimes and the the articles still don't load. So they must hide the cookie or have another way of detecting the 10 articles per month. I know its not by IP address because when I round through my ten in Firefox, I can get ten more from Internet Explorer, and ten more from Google Chrome.
So, does anyone have any suggestions on how to find this cookie, or whatever else is keeping count?
Sites can also store data through Flash LSO's (Local Storage Objects, also called "supercookies"). I have no idea whether NYTimes uses this method. Adobe has a widget online to view/remove data stored by sites that do:
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html
You also could try a private window as a workaround for data stored in your regular windows. Just watch out for blocked content due to tracking protection:
Thank you,
I used the Adobe widget to delete all of these super cookies.
In a private Window I went to nytimes.com and it allowed me to load an article. I was able to use the script I saved to a bookmark and print the page as it appears with pictures.
But I went to five pages, and at the fifth page I got the message that I've used up 5 of my 10 articles for the month.
I went back to the Adobe widget and there were no new cookies. So nytimes.com apparently doesn't use this method. But somehow, its still tracking my number of visits.
I played with the tracking protection and found no difference between basic and strict. So I set it back to basic.
By trial and error I discovered that each time I open a new private window in Firefox, the article count starts over. So I can get to ten articles, close the private window, open a new private window and start over.
So between the script for printing pictures saved as a bookmark and the private browsing window, it seems to have solved my problems.
Now, I'll ask the question, will that script work on other sites that are not picture friendly, or is there a way I can modify it for various sites when I have a problem? I can't remember the particular site, but there was a recipe I tried to print a few months ago and I couldn't get the pictures to print.
So if you have an answer to that question, please advise.
Hi paul459, it really sounds like NYTimes uses regular cookies for keeping track, but possibly the cookies is set by on a related domain rather than by the main server at nytimes.com.
Regarding scripts for other sites, it really depends on the layout, unfortunately. It's very likely to be different on a recipe site (they probably don't use selectors like story, media, photo). But if you post a link, we can probably figure it out.
Thank you! Next time I run into the problem on another site I'll post the link. Should I mark this post as solved, or keep it open for the next time?
選擇的解決方法
paul459 said
Thank you! Next time I run into the problem on another site I'll post the link. Should I mark this post as solved, or keep it open for the next time?
It's probably best to mark it solved. That way the forum will allow it to be indexed by Google and it could help others with the same question.
A website can also use localStorage to store data locally. You can type locaStorage in the Web Console ("3-bar" menu button or Tools -> Web Developer) to see if any data is stored. The SUMO website uses this to store the open/collapse state of some of the menus in the sidebar.
I see this:
Storage { for-contributors-sidebar.folded: "false", editing-tools-sidebar.folded: "true", announce-geoip-suggestion.closed: "true", question-details.folded: "true", tags-list.folded: "true", question-tools.folded: "true", related-content.folded: "false", length: 7 }
See also:
由 cor-el 於
Happy New Year!
Here is an example of a recipes webpage where the picture doesn't print.
http://www.everydayhealth.com/news/caramelized-red-onion-fig-pizza/
PS:
The post above:
"A website can also use localStorage to store data locally. You can type locaStorage in the Web Console ("3-bar" menu button or Tools -> Web Developer) to see if any data is stored. The SUMO website uses this to store the open/collapse state of some of the menus in the sidebar."
is over my head. I'm still not sure what to do or what to look for. Will you please clarify. Thank you!
paul459 said
Here is an example of a recipes webpage where the picture doesn't print. http://www.everydayhealth.com/news/caramelized-red-onion-fig-pizza/
Yes, the large image area is omitted. You can unhide it using this bookmarklet:
javascript:var s=document.createElement("style"); s.appendChild(document.createTextNode("@media print{.hero-image-container{display:block !important; position:static !important;}}")); document.body.appendChild(s); void 0;
Not sure how generalizable that is, but many sites have a giant banner area they refer to as the "hero image" so a similar thing may work there if they used that class name (hero-image-container).