Printing Iframe content - javascript

Can any one tell me the complete cross browser solution to print the contents of iframe.I followed the following links.But it is not working in chrome 3.0 browser & IE8.It is printing the entire page.
How do I print an IFrame from javascript in Safari/Chrome
Print iframe content in Opera and Chrome
Thanks for your valuable help...

As to Chrome, version 3 is way ancient. Please give a try to some newer version (like Chrome 16) and see if it works there.

Related

window.print not printing all pages in IE

I have a page that contains iframes, i want to print them all using window.print() it works in chrome but not working in IE, it just prints the first page not the rest.
it just prints out the first page not other 5 pages.
any help would be much appreciated!
Not clear with your situation but to help, in IE window.print will always try to print the browser window and not the iframe window you are in unlike chrome and firefox.
To print corresponding iframe window in IE, do something like this.
window.top.document.getElementById("iframe-id").contentWindow.focus();
window.top.document.getElementById("iframe-id").contentWindow.print();
Hope this helps.

xml ticker not working in Google Chrome

I'm using this script since years in an old website. Now it's no more working with Google Chrome, but it's ok with Firefox and IE.
If you open that site, you'll see a yellow box. With Firefox and IE it's populated with strings or images scrolling, while with Chrome it remains empty. Can anyone explain why?
see https://stackoverflow.com/a/18444795/420006
.load doesn't appear to be valid in Chrome

javascript window.print() internet explorer 8 not printing entire webpage

When printing from windows7 with ie8; only whats visible in viewport is printing.
Printing from windows8 which I believe has ie9 prints the whole webpage with no issue, about 5 pages in total. It will work with compatibly view enabled though.
All is checked from the print prompt so that's not an issue. This was brought to my attention from a user so its not an isolated issue. Any help is appreciated.
I had to set the body to static
body{position: static;}

JavaScript for iPhone to open in Safari from non-default iOS browser

"googlechrome://www.lego.com" opened in mobile Safari will switch to Google Chrome iOS app to open the URL. This allows for scriptlets like the one below, which allows you to open the current page in Google Chrome iOS app, switching from mobile Safari:
(function()%7Bif(document.location.href.indexOf('http')===0)document.location.href=document.location.href.replace(/%5Ehttp/,'googlechrome');%7D)();
My question is, can the reverse be done? I tried "safari://www.lego.com", and it is simply an invalid URL. Can you make a scriptlet which switches from Google Chrome to mobile Safari to open the current page.
The answer is yes. Courtesy or MacStories (http://www.macstories.net/tutorials/chrome-for-ios-send-a-webpage-back-to-safari-via-bookmarklet/), I found this code:
window.location='googlechrome-x-callback://x-callback-url/open/?url='+encodeURIComponent(location.href)+'&x-source=Safari&x-success='+encodeURIComponent(location.href);
Execute that code, go to your homescreen, reopen Chrome, and there's a magical back button to go back to Safari. This may not be exactly what you want, but it works... Kink of.
Good luck!
Update:
Here's a screenshot:
Link (Sorry, I don't have enough reputation to put it right in the post): http://i.stack.imgur.com/OR175.jpg
Update:
It seems that the functionality to do this has broken. Thank you!

Canvas application not working in IE9 & working incorrectly in FF4b7

I'm working on an online roguelike game. It's current version is located here. It's working fine in Chrome 9 and Firefox 3.6, but it makes Firefox 4 beta 7 unresponsive for about a minute on every move and IE9 just says that it doesn't support <canvas> tag.
Could someone please explain these strange behaviours of IE9 and FF4b7?
Thank you very much.
In IE9 hit F12 and you'll see your site is loading in quirks mode which is why it doesn't have canvas. From F12 you can switch it and see that you're site does work if it is in IE9 standards mode.
I think you want to put DOCTYPE html before everything else to avoid this.
http://en.wikipedia.org/wiki/Quirks_mode
I am posting this in case it helps someone else (I found this page when I was googling)
Pages worked fine in Firefox
In IE9 pages were working locally, but not from server. ("getContext not supported etc. etc.")
Had run out of ideas, but noticed that a trial of part of my page containing canvas did work.
Long story short:-
My pages were .htm and so I thought "Is there an HTML5 standard ?" well I'm not sure if there is but when I changed all pages to .html the site behaved as intended in IE9 with all canvas elements working.
Bob

Categories