How to pass user activation to iframe to open file chooser dialog - iframe

Trying to open an upload file dialog(through file input element) embedded in an iframe upon click of a button in the parent window. Instead, this error is thrown "File chooser dialog can only be shown with a user activation.". Parent window and iframe source are hosted in different domains.
Is there any way to transfer user activation to iframe?

Related

QDialog: show() vs open()

Whats the difference between QDialog::show() and QDialog::open()?
show() will just show you the dialog without affecting the other windows in your program. open() will show() the window + prevent other windows from being accessible through setWindowModality(), i.e., it becomes a modal window.
This is useful if you want to open a file, for example, and you don't want the user to be able to do anything in the program until a file is chosen and that dialog is closed.
Quoting from Qt's manual:
A modal dialog is a dialog that blocks input to other visible windows in the same application. Dialogs that are used to request a file name from the user or that are used to set application preferences are usually modal. Dialogs can be application modal (the default) or window modal.
When an application modal dialog is opened, the user must finish interacting with the dialog and close it before they can access any other window in the application. Window modal dialogs only block access to the window associated with the dialog, allowing the user to continue to use other windows in an application.
The most common way to display a modal dialog is to call its exec() function. When the user closes the dialog, exec() will provide a useful return value. Typically, to get the dialog to close and return the appropriate value, we connect a default button, e.g. OK, to the accept() slot and a Cancel button to the reject() slot. Alternatively you can call the done() slot with Accepted or Rejected.
As it is stated in the doc, QDialog::open()
Shows the dialog as a window modal dialog, returning immediately.
whereas QDialog::show(), which is in fact QWidget::show(), will only show your dialog as a standard, non-modal widget.

How to save an open, editable file in QWebView?

I have a page open in QWebView which is editable with the contenteditable attribute. When a user clicks a save button, I would like to save the content in the file which is already open in the QWebView. Is it possible?
You can obtain the QWebPage with QWebView::page and the QWebFrame with QWebPage::mainFrame. You can then get the content of the page with QWebFrame::toHtml and save it to a temporary file

How to show modal dialog or popup of FMElfinderBundle integrated with TrsteelCkeditorBundle?

I want to use FMElfinderBundle on modal dialog. Now when i click on Browse server botton on Ckeditor new tab on my browser opened and I should work on it to upload image or select one image that is existing on server directory.
As i know current version of CKEditor doesn't support modal/iframe based calls, you can use TinyMCE, that opens filebrowser in iframe.

window.open in web application for iPad running in fullscreen replaces the existing window

I am writing a simple (ASP.NET) web application for the iPad. It is written and works well however one feature is it serving up PDF files (among others). To do this I used window.open to open the file.
When this is done in Safari, it works perfectly. You click the button, the file opens in a new tab; you can then close the tab to return to the previous web page.
However now running the application in fullscreen mode - i.e. with the appropriate "meta names" set and from a shortcut on the home screen - when you click the button to load the file, it loads fullscreen with no means to get back to the last page.
Because it is a file, not a webpage, I can't put a "Back" button on, and when you press the iPad button it simply closes the whole thing.
I know this has been asked before and I have read a number of similar questions - the closest of which was this:
https://stackoverflow.com/questions/9168236/web-app-hyperlinks
If at all possible, it would be far preferable (thanks to the control library I am using) that the button click is done with javascript - it is not easy to set the link href.
The upshot is I really I just want to create a new window from within a fullscreen iPad web application, or allow the "back" navigation somehow...
Is this possible?
Thanks!
Create an iframe on your page rather than using an window.open and set that as the target.
That way your pdf would open within your existing window.
Use some client side javascript like jQuery to style it like a dialog window.

add jquery tab from outside page

I have an application that uses jquery tabs to open up different asp.net applications from its "menu" tab. The content of the tabs is an iframe with the application. What I need is for one of the application tabs that is inside an iframe to open a page in a new tab. I am running the apps in iis 7 with asp.net. how can I send a signal to the "tabs" application to open a new tab?
window.parent will allow you to access the outer app.
as #Anthony suggested you can use window.parent and window.parent.document to access objects on the parent window containing iframe, but better way will be to write a function on parent window to open new window and then call that from iframe code because it is more foolproof.
//in parent window
window.openNewWindow = function(/*ANY PARAMS*/){
//open window here
};
//in iframe
parent.window.openNewWindow(/*PARAMAS (IF ANY)*/);

Resources