Excessive number of pages when printing a webpage - printing

So I am trying to print a webpage with javascript:window.print();. Rest of the website works perfectly fine. There is this one page where the data is coming from 3rd party sources which might be the culprit but I am not sure at this moment. But when I try to print this page the print window shows 'Loading preview...' and total number of pages are astonishing 31000+. When it should hardly be a 3 page print.
When I turn OFF my VPN (which allow me to access those 3rd party sources and fetch and render the data on the page) the access is revoked from the 3rd party sources, making the print work fine with only 1 page.
I tried searching on the internet for this issue but no luck.

The application is built in Drupal 9 having twig as template engine. So I simply fixed html indentation and found out it was an extra </div> tag which was causing this issue. So guys always indent your code and be careful with writing lots of html in a single template. :)

Related

Angular JS and jQuery Mobile routing - treatment of hash anchors in the URL

This is my first question on SO so i'll try and make it as clear and as understandable as possible.
I've recently started messing around with Angular JS and currently I am working on a mobile app using Angular JS and jQuery Mobile. So far I've not had any major problems and so far have no had a need to consider any external libraries for integration (such as the angular js + jquery mobile adapter). I've created a multi-page app (currently only two pages) and used separate controllers for each page (login + content page). The app itself is simple, it's just a list keeping app and i've created a quick jsfiddle based on the ui aspect of the content page: http://jsfiddle.net/G7JNV/4/
The app works as expected from the jsfiddle. However because the content page is a page in the same html document (index.html) as the login page, to navigate to the content page the url becomes:
.../index.html#mainpage
(mainpage being the page for the list keeper)
Thats when things start getting funny. When the url is like above, when adding an item to the list, the item is initially unstyled (it doesn't look like it's part of the list) but the css styling for that item comes back after adding another item. Of course the next item is then unstyled (and so on).
If you want to see what the issue looks like:
Everything however works fine if i don't have the hash page as part of the URL (I tested this by turning the two page app into just one page for the content so that .../index.html goes straight to the content page). The css is applied to the dynamic content fine as one would expect.
Of course I have no idea why it's doing this and I suspect that it's something to do with how angular and jqm treat the hash anchor in the URL (but bare in mind I don't have much experience in both Angular JS nor jQuery Mobile).
Any help from any of the more experienced Angular JS (and jQuery Mobile) users would be greatly appreciated!
You should be creating a directive that encapsulates the list and the logic that you have for it.
As suggested in the comments to your questions, a timeout can work. If you're having issues with the element "flashing" or "flickering", you can use the ngCloak directive to deal with this.
You may also want to check out the $locationProvider configuration in your app and turn off HTML5 mode or set the hash prefix.

Google Analytics MIME type issue in Chrome using Rails 3

I'm adding GA to a Rails 3 app, which would normally be extremely simple, of course. I've added the GA JS snippet, which is rendering just fine. Everything works perfectly in Safari. In Chrome, however, it's giving me a console error: Resource interpreted as Script but transferred with MIME type text/html: "about:blank", pointing to the JS line that loads the ga.js file: s.parentNode.insertBefore(ga, s). Some things I've investigated:
I created a plan HTML page with the JS snippet, and it loads outside Rails in Chrome with no error.
The same HTML page, when put in /public, gives the error above.
The same HTML page, loaded in Safari from /public, doesn't give any error according to Firebug.
I tried the GA Debug extension in Chrome, but it remains silent, because ga.js isn't getting loaded.
Looking at the developer console in Chrome, I see a request for "http://www.google-analytics.com/ga.js" that seems to stay in "pending" state, and a redirect to "about:blank" seemingly initiated by http://www.google-analytics.com/ga.js, which makes very little sense.
So this seems to be related to Rails (since the snippet works in the HTML outside Rails), and doesn't affect Safari, but other than that I'm stumped. Hopefully I've just been staring at it wrong, and someone else will point out the obvious to me...? Anyone come across this before? Any ideas will be very much appreciated.
Came across this issue myself. "Disconnect" disabled share buttons on my site (g+, twitter and fb). Had to remove it to view the site properly.

HTML link to specific pages in PDF

I have looked around the web and have found that appending #page=?? to the end of a PDF link will automatically take the visitor to that specific page in the PDF file.
I was wondering if this is still best practice as it doesn't seem to be working for me (Chrome on Windows 7). Also, all the articles I have found so far date back to 2006-2008, have things changed recently?
This is still valid code but it may require that some version of Acrobat (Reader, Pro, etc) be installed as a plugin on the browser in order for it to work as expected. Since multiple commonly-used browsers now have a built-in reader (Chrome, Safari for iOS are the big two that come to mind) support for direct page linking is somewhat spotty now. You can still do it...the worst case scenario is that the PDF just opens to the first page for those users but I would advise to just leave off the direct page link. If the page is that important, extract it to a separate PDF and link to that.

Why does SIFR rendering this page in Chrome as a blank page?

In chrome - http://unitonenine.com/ loads for a few seconds that changes into a blank white page. This site was working fine up until a few months ago.
Upon inspection it just loads the 2 swf files. In FireFox it loads just fine.
Any thoughts?
I posted some information regarding the same bug that seems to be removed. So I poked around the javascript source for sifr r436 and discovered as was mentioned here:
http://discuss.joyent.com/viewtopic.php?id=24243
That there was an issue with the prefetch function and indeed commenting the prefetch function out fixes the problem. I looked at the site linked above and this is not their solution. I have not been able to figure out how they resolved it, the prefetch function is unchanged on their site. So removing the prefetch would make this problem go away, however it is important to know that this will slow total page load time by putting off calling the flash file until after the rest of the page loads.

Firefox Extension - Need a specific div to ignore xhtml errors (mismatched tag, etc)

My firefox extension loads content from a 3rd party site into an overlay panel. This content is user generated and sometimes will, for instance, have an image tag that does not close which causes a mismatched tag error to be thrown and the extension fails. Is there any way I can sandbox this content so that these kind of errors are not an issue? I was thinking maybe load the content into a blank iframed page.. but was wondering if there might be a cleaner solution.
Unfortunately, unless you're getting back XML, there is no XPCOM solution for parsing. Your best bet is what you suggested - placing the content in an iframe.
You can find some more discussion about the topic at: http://www.mozdev.org/pipermail/greasemonkey/2005-April/001255.html
Your guess about an iframe was correct, there's no better way to do it (as of Firefox 3.5): Parsing HTML From Chrome on MDC

Resources