take screenshot on web page with flash element - javascript

I would like to take a screenshot of a page displayed in a WebView. The page may contains flash elements, I refer to google feedback, but when I take a screenshot all the flash parts of the page are blank.
The flash element(for example video) can not be controlled because it is not my own website.
Beside I do not want to use any extension of browser.

It's impossible to take a screenshot of Flash elements on the webpage using JavaScript embedded on the same page. All available JS solutions (more details here) are reading current DOM state and rendering (using JS render engine implementation) a web page on a canvas element. Flash object is executed by separate application - Flash Player. JS can't access its contents, there is no Flash render engine implementation in JS.
However, since you mentioned WebView and you are talking about Flash then I assume that you are working on the native Android app. Therefore, it should be fairly easy for a native app to create a screenshot (see this).

Related

How to trigger native screenshot function of iOS and Android via JavaScript?

I am currently working on an Ionic Vue App and want to take a screenshot of the entire page. Since I have multiple canvases with different context types on the screen, famous libs like 'html2canvas' do not work for me. The cordova plug-in also was no success for me sadly.
Is there a way to trigger the native screenshot function of a device via JS? The taskbar at the top as well as buttons at the bottom are allowed to be visible on the screenshot.
My app is not designed to be used on PC, so I do not have to worry about this platform.

Viewing Javascript source in Safari Web Inspector in a UIWebView

My iOS app includes a UIWebView which runs some Javascript. I am able to attach Safari web inspector to my apps UIWebView instance and have the debugger invoked when a breakpoint is hit, however I am not able to view the actual javascript code.
I am able to see the variables and the call stack, but the source code window is blank.
Is there something that needs to be done in order to make the source code visible?
Switching to the DOM tree view does show the contents of the page, but this is not source level javascript debugging.
Is it possible to actually have the source code for the Javascript being debugged visible in the web inspector?
The reason that the code is not visible is because I was making use of the loadHTMLString method on the UIWebView.
Making use of a file URL and loadRequest to load the request allows for the code to become visible.

Android WebView Javascript Issue

I'm quite new of Android and during the development of one app, I have encountered the following issue:
I'm using a WebView inside my app for viewing web sites (it does not matter what kind of site, can be Google or Reddit or anything else). I know I can use a "browser Intent" with Intent.ACTION_VIEW but for the purpose of my App I must use a WebView.
So, I have enabled javascript and DOM api storage with:
getSettings().setJavaScriptEnabled(true);
getSettings().setDomStorageEnabled(true);
My problem comes after that the page has finished loading and some Javascript automatically starts. Basically if the user has already scroll down and the Javascript tells the page to hide/show some content (example a DIV) the scroll resets to top.
My question is:
how can I avoid this behavior? I want that the Javascript loads correctly but it does not interfere with the user's navigation. Is that possible?
Thanks in advance,
Best A.

How to take convert a webpage to a image in javascript / Google web tool kit

I have a requirement to convert a webpage into a image. When a user clicks a button the new window need to display the webpage as a image.
IS it possible to do in Javascript or Google web tool kit?
Take a screenshot of a webpage with JavaScript?
Firefox has a "drawWindow" method on the canvas element that lets you copy a screenshot of the window into a canvas element (from where it can then be extracted). This is however not enabled for webpages (only for add-ons), because it forms a security risk: http://mxr.mozilla.org/mozilla/source/content/canvas/src/nsCanvasRenderingContext2D.cpp#2352
In short, plugins (or activex components) are the only sure way to go. Browsers aren't going to provide this as standard functionality because the risks outweigh the benefits.

How to open file dialog in Flash 10 "without" user interaction

I want to open a file dialog via FileReference.browse() but I get #2176 error which means that this action can only be invoked upon some user interaction. I'm aware of security considerations but in my scenario I have a thin flash movie which merely displays an image and the whole UI is in javascript (I heavily use javascript <-> actionscript communication).
So the question is - do you think it would be possible to invoke FileReference.browse() upon the user interaction coming from javascript?
No. If it is anything like accessing the clipboard, then you are stuck out of luck. I have tried all sorts of hacks to get around that, from setIntervals to using apply, I even tried using a ByteArray to manipulate code directly. No soap.
For that matter, you'll have to upload the file to a server using FileReference (unless you're using AIR). This is really annoying if you need to have Flash look at it.
The problem is that when Flash makes this type of decision, they are not making those aspects of the classes accessible by code directly. The code responsible for actually accomplishing these things is locked in the native code which is built into the FlashPlayer. We're black-boxed out.
Back when Adobe first updated their security model, and in turn broke quite a few running flash based upload services, there was a
pretty
big
stink.
I believe that some people were working around the new limitation by essentially creating a transparent flash movie, and overlaying on top of an otherwise normal HTML element, to 'trick' the user into giving the flash app input from which to trigger the interaction (where they think they are clicking on a simple html button labeled 'upload' they are actually clicking on the invisible flash element sitting on top of it.)
I've not tried this method myself, but it may give you a direction in which to search for a solution that might work for you.
Isn't this the purpose of object and embed tags in html? When you say the whole UI is in javascript I am assuming you are using html markup as well, though I guess this may not necessarily be the case.
How to embed a flash file in html
How to start a flash file with javascript
Ok. I've found this link: Flash Player 10 FileReference Changes. Apparently there's no workaround for this limitation. I guess I'll have to display a prompt for the user from within the flash movie, so that he/she can "interact" and allow to open the dialog.

Categories

Resources