Flex: How to examine if document is loaded in iFrame? - apache-flex

I'm using an iFrame to show documents in an flex app using ExternalInterface.
Is there any way (events?) to examine when document loading finished?

Related

scraping video links from lazy loaded videos

I am trying to scrape a video from a page using a package called icrawler, but that video is not rendered instantly when a page loads, so when I get the html code of that page, the video tag doesn't exist but it does if I open the page in the browser and inspect.
How do i wait for the page to load the video before crawling it ?
The page most likely loads the video using javascript so, you would need library capable of rendering/executing HTML and javascript.
I took a quick look at icrawler and according to the doc it uses Cheerio which quoting from its doc "does not produce a visual rendering, apply CSS, load external resources, or execute JavaScript".
The same docs mention that you could use something like PhahomJS (seems to be abandoned) or JSDom. Another alternative is to use Selenium.

PDF iframe in UWP application

We have web application, it contains iframe with src attribute linking some pdf resource. In browsers (Edge, Chrome, Opera) user can see pdf in this iframe.
But now we createed UWP application showing the same html pages. When user open the page with this iframe, iframe is empty and the pdf is automaticaly opened in the browser window.
How to enable support for pdf in iframe in UWP application?
If I understand your question, you want to use WebView to show a web page. The web page has a <iframe> html tag, the iframe's src is a online pdf file. For the UWP built-in WebView control, it doesn't support pdf file.
So, if you want to render pdf in UWP, you could use Windows.Data.Pdf classes.
In addition, if you say you have to use WebView to show pdf file, you could try to find some JavaScript ways to render the pdf file on web page and then show it in WebView.

Prevent Google Chrome Content Scripts from interfering with webpage DOM CSS definitions

I am building a Chrome extensions which injects a decent amount of JavaScript, CSS, and HTML into the page DOM for the current webpage tab. It it does so to show a Modal window with my extensions functionality in that modal.
I cannot use the background or popup scripts to do what I need to do so I have to use a content script which injects into the actual page DOM.
My issue so far is I have to be super careful with CSS class names and JS as well as I have discovered if the page has a CSS class matching the name of any of my extensions CSS, my extensions ends up over-riding the pages CSS!
I have seen that some other extensions that have to do a lot of HTML, CSS, JS into the content end up injecting into there own Iframe in the page which helps prevent this name collision.
Is using an Iframe the standard best practice in this case?
One of the features in my extensions is to do full-page screeenshots which require my contnet.js script to send a message to my background.js script which is responsibble for calling the CHrome API and taking the screenshot of the current scroll position in the pages viewport.
user clicks button in DOM modal windows
content.js sends message to background.js with the coordinates of the viewport.
background.js takes the screenshot with those coordinates. THen sends a message back to content.js.
content.js then scrolls down the page to the next area of the viewport for the next screenshot and then sends those new coordinates back to background.js.
this cycle continues until a shot of the whole page is made and stiched together and then sends back the URL of the new image to content.js when done.
Because both the Chrome API needs to sends messages back and forth between my content.js and background.js and then also if there is an iframe the iframe has to send messages back and forth with the page and the iframe.
Because of this I am not sure if I could use an iframe or not even?
Also if I did use an iframe, it would not load the content from a remote server but instead would be loaded into the page as html.
So is there a best practice for doing this?
Use inline styles instead
You can wrap your css in content.js then apply it to your target elements, it won't interfer the original design of the webpage
Use Shadow DOM
It provides encapsulation for js/css and makes it easy to ensure your components separate from the DOM of the main document.

Meteor: Exporting rendered template for offline use

I have an online tool for users to build and preview slideshow presentations (uploading images, editing text).
Would there be a way to "export" the content of a rendered slideshow for offline use? This would mean the user could view the presentation locally in a browser using only static files.
Use
var myRenderedHTML = Blaze.toHTMLWithData(templateYouWantToCache, dataUsedToRenderTemplate);
Then use something like the Filesaver.js library to force download of that content as an HTML file. (as in the last demo on this page)

Prevent iframe from adding entries to browser's history with links inside a pdf document

I cannot figure out any way to prevent that behavior with hyperlinks inside a PDF document. Is there any way to achieve this?
We cannot replace iframe with object or embed tag.
# Jared Farrish: Nope, we want to prevent links in a PDF document being added to browser's history. For example, a PDF document is loaded in an iframe, it also contains links to other pdf documents. When users click on a link, new pdf one is loaded into target iframe, also an entry is added into browser's history. I need to prevent that.
#GolezTrol: Because it's the requirement, if you place it in an embed or object tag, when clicking on a links, your site will be redirected to another new pdf document. I need to load a new pdf document without navigating away the current web page.
At least in my test using FF4 and Chrome (latest), using a Javascript appendChild did not add it to the history.
var iframe = document.createElement('iframe');
iframe.src = "https://web3.unt.edu/riskman/PDF/UNTSafetyManual__Revised__3-2-06.pdf";
document.body.appendChild(iframe);
http://jsfiddle.net/ZML3u/

Resources