PDF that contains javascript runs this code when embedded in html and displayed in Chrome. This is better described in this closed issue https://bugs.chromium.org/p/chromium/issues/detail?id=511295
Is there any way how to disable the javascript support alltogether? Sadly i wan't even able to find what exactly is supported in chrome pdf viewer, only that this shouldn't lead to XSS. Still, randomly popping alerts are annoying even without immediate security threat.
Related
I have a JavaScript string which I want to be downloaded when the user clicks a particular button.
I have got it to work on Firefox and Chrome using a data URI and creating a new anchor element which links to this data URI.
However, I found out that this way of doing it is not supported on IE due to security reasons.
Can someone tell me how can I download a file on clicking a button so that it works on IE using Vanilla JavaScript?
Thanks for your help.
Kevin
Our site has PDF's embedded into our pages which allow the user to print them. We have this working across all browsers/platforms using various techniques PDFjs/PDFObject/iframes etc...
However when it comes to the Edge none of these techniques print properly. Using the an iframe which I assume is using the native PDF viewer there is no print option (only Save As), If I print using the Edge toolbar I get all the html content around it (I appreciate that I could hide the rest of the content using css for the print, but I was hoping there would be a cleaner way). Using PDFjs prints the whole page not just the PDF. PDF Object just tells me I don't have Adobe Installed preumably because there is no ActiveX support.
So my questions are has anyone else worked out how to print out an embedded PDF in Edge yet? And if you have how?
Microsoft are aware of this issue in Edge, and are looking to introduce it in the upcoming Windows 10 Creators Update (Version 1703, AKA Redstone 2 or RS2), scheduled for Spring 2017.
As far as I can tell there is no current solution to this problem.
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7801755/
Right now I have a webpage that renders differently on internet explorer than chrome. I want to load an iframe that holds this webpage. When the webpage is shown within the iframe I want it to render in the way it renders on Internet Explorer. Is there a way to ensure that even users who run this application on chrome/firefox will see the iframe loaded with the internet explorer configuration? I was not sure if the iframe automatically conforms to the browser the webpage is being run on or if there is a way to change the iframe to have it render the way a specific browser would?
No, the page within the iframe will be rendered by whatever browser is rendering the parent page.
Instead, you should focus your efforts on developing a website that operates correctly in all of your target browsers rather than just IE.
There is a vague chance you can do it with CSS but it's highly unlikely. What renders web pages in a certain way is the browser of the user themselves. That's what translates the HTML and that's why your code looks different, because Chrome translates it one way, and Internet Explorer a different way (by the way no one uses IE since XP).
That's basically it. Somehow, the javascript in Google Docs can turn off the default headers and footers showing the URL, date, page numbering, etc.
This only works in Google Chrome. When Google Docs is running from another browser it will print the headers/footers unless removed manually through the print configuration dialog. In Safari, it seems to generate a PDF server-side which of course will print outside of the browser.
I've searched around the web and have found nothing on how this is done. The javascript in the page is of course minified and obfuscated so it's difficult to get any insights from there.
So before I'm forced to dive into that spaghetti, I'd like to know if anybody has any ideas of how this is done.
After delving into some source code I found on a web page that has also resolved the issue (not Google Docs), the secret is the following CSS:
#page
{
margin:0;
}
This only works on Chrome, and perhaps Opera though I have to verify if the latter is true as it's printing the background color by default while chrome prints with a white background and the colored background in my page might be just obscuring the header/footer text.
Other browsers give differing results:
Firefox and Safari ignore the margins apparently and print the headers/footers anyway.
IE9 makes a mess of things and the contents print overlapped with the header/footer text. Poor browser always gets all the heat...
In conclusion, combining this with silent printing coming out in Chrome 18 kiosk mode will make for some interesting functionality, such as mail merge capabilities right from the browser though I still have to research how secure kiosk mode is though, as navigating to a malicious page runs the risk of exhausting printer ink and paper.
Navigation should be restricted to a URL white-list in this case.
I'm currently trying to put together a rich text editor that includes widgets from a different location then the site the rich text editor is on. I'm doing this by providing an Iframe in the content area that is placed at the cursor.
Now the idea behind this instead of providing some kind of placeholder until they finish editing is so they can see what they are talking about while they type.
Now the iframe works perfectly fine in Chrome loads the content as expected, but in Firefox it seems to have disabled javascript in this case (notice none of the script files being downloaded), which is an issue as the widgets are extremely javascript heavy and don't function without it.
I have provided below a JSFiddle showcasing this issue, the site im loading in the iframe is just a javascript game but you will see it doesn't work in firefox but its okay in chrome!
http://jsfiddle.net/reefbarman/2uYja/2/
Any help is appreciated
Scripts won't be executed when designMode is activated (source). Internet explorer was the first browser to add this feature, and Mozilla implemented a similar function, heavily inspired by Microsoft.
Your code functions in Chrome, because Chrome has implemented designMode in a different way.
Well after some research and experimentation I was dealing with two different issues that looked like one.
Firstly I made a change to the rich text editor I was using to use contentEditable only as this seems to be the standard going forward and its a heavily html5 app im working on. So with designMode = 'Off'; the iframe would load in normal situations. But I had a strange issue where adding the iframe to soon after adding another element to the editable area caused the iframe not to load, so just delaying the add of the iframe by some time allowed that dynamically added iframe to load!
Problem solved!