I have a application that allows a user to choose some parameters for a powerpoint report, run the report, then allow the user to "save" or "open" the powerpoint file. I got all of that working OK. When you click on "run" report, it pops open a window which generates the report, stores it in session, then closes the window. I have a button on the main page that will export the report.
So, now, when the pop up window that generates the report is finished, i use "window.opener" to call a javascript method on the main page, that will do a javascript click of the button. when this button is pressed, Internet Explorer gives me the following message : "To help protect your security, Internet Explorer blocked this site from downloading files to your computer.."
Do you guys know of any tricks around this?
The browser doesn't like it when you try to make a download happen from some context other than a user-triggered event (like a "click"; maybe only a "click"). The user can adjust the security setting, but obviously that's not a solution for most people.
Really the only thing I know to do is to re-think the way that users interact with your pages, so that you can make sure that only actions invoked directly from button clicks (like, URLs that are the targets of form submits, for example) return a download. It's a pain.
Related
I want to load test one scenario for the load testing a ASP.net site.
There is one grid of records that contain kind of scorecards.
When user Click on view for any one record, new Tab will open with that scorecard detail. And in which user can select Review or Dispute radio button and simply submit the form.But when user click on the Submit button, one pop up comes with the OK button in it. And when user click on the OK it will close the newly open Tab(score card detail) and update/refresh the that Grid page.
So while recording of the scenario when I click on the submit button I am not getting any confirmation pop-up(as Jmeter is not able to execute Java script). and also there is no database entry for that form submission.
This scenario is working fine in normal user actions(without Jmeter).
While recording I can also see the Request recorded for Form submission but not reflected in database.
I am not sure if this is because of the limitation of the Jmeter of inability to execute Java script or something related to Proxy settings.
But after the talk with the developers they said before the java script alert, another code/method is executed for database entry. So could not figure it out what exactly the problem is SO looking for some help from you guys.
jmeter- during its execution runs in non-ui mode while java script is used for basic validations and making the user interface comfortable
a better approach or a solution is to have a chat with the developer to disable the pop up and complete the action without a popup (or a button within browser itself in case of any dependency of button to execute the functionality) in your local environment to proceed further
I know that one can use ports to detect popup close. However, this doesn't work when there is information on the popup that I wish to persist.
For this extension I need to be able to save the textarea contents to sync storage when the popup is closed. There already is an update button which manages this, but no way to temporarily halt and save the status if the popup gets (accidentally) closed.
One way to do this is to keep storing the content on keypress, but I'd rather not hit the storage so often (especially since it's connected to some other event handlers).
Is there any way I can mimic onbeforeunload for a popup without being too heavy on the I/O?
All extension pages (background page, browser action popups, etc.) share the same process and get direct script access to each other via chrome.extension.getBackgroundPage / chrome.extension.getViews, so one thing you could try is having an onbeforeunload event in your popup which grabs a handle to the background page and passes over any javascript data to the background page, and then have it do the serialization. You can even hand over a chunk of DOM by using document.adoptNode.
In general though we encourage more of a "save as you go after a few seconds of user idle" approach to writing extensions and apps, because your code can unexpectedly stop running for lots of reasons (entire browser or OS crash, loss of power, etc.). Obviously this is harder in cases where you have a big data structure to save, because you then have to start looking at how to do incremental save, etc.
Use localStorage to save the data and setPopup to save the page see here Keep a chrome extension popup after close it
I'm looking for the best way to go about "forcing" the user to fill a textarea.
For my work we have a system that keeps track of time spent on a particular "task". Some tasks are required to have a comment while others are optional. At the top of the page there is a timer, a textarea for the comments and a list of different tasks.
So far I have it so when the user tries to stop the timer, it won't stop until the comment is written (if it is required). When the paged is closed while the timer is running, an onbeforeunload function sends an alert warning that the comments aren't filled out and then the "Are you sure you want to leave?" warning pops up.
As far as I can tell there is no way to prevent the user from completely exiting the page. The idea we had was when the user closes the window, have another simple page open that just has a textarea and an instruction telling the user to write a comment. I'm pretty new to JavaScript and web development so I'm not entirely sure the best way to go about this.
Put that text area in a popup or iframe or modal window where you can control its closing.
On these window.close you can call the functions to validate the text area is filled or not.
Am not sure you can put that in a popup or not .but thats the only good way i can think of !!
There is no way to prevent the user from leaving a page.
Built in pop up blockers will also block the system from opening up popup windows onunload. Only way to allow onunload popups is if your system admins can update every browser to add an exception to the browser security settings.
It is impossible to make a web application act like a client application.
Our application forbids going back for several reasons.
Basically because that's just how our application works (JSF with facelets as GUI)
You always have to enter on the welcome site, once you chose an application-flow you can only leave / abort when you tell the application (e.g. press a button). If you just browse away e.g. enter "example.com" in the address bar the state of your flow gets saved and once you relogin, you can resume the work. Going back is only possible when it was specifically designed like this with a 'back' submit - button.
Of course users keep pressing the 'back' button (i would do so as well) and they keep getting 'error: session out of synch'. This is a learning process and a couple years ago we just disabled the back-button to make things clear. Sadly this is no longer supported.
So instead of teaching the user the hard way and forcing him to relogin, are there some good alternatives I'm missing?
i found this link which should offer 3 methods to disable the back button - but in reality it just further confirms the fact that it is impossible to do it in a semi-nice way.
when the user tries to go to a previous page you can redirect him to the page he should be at in other words catch the "out of sync" and redirect him
You might find a workable solution here How do I insert an entry into browsing history via JavaScript
by inserting an extra step into the browser's history (perhaps a link to the current page with query string parameters that result in a nice big red box message to the user), or you could try attaching an event handler to the OnBeforeUnload event so the user gets a confirmation dialog when trying to leave the page (you'd want to remove the handler when the submit button was clicked).
Here is what I need to do:
I want to launch a popup window when the user exits the website.
I found code that detects when the user closes the window, but that same code ALSO fires when the user clicks on an internal link,
(which I don't want).
Any ideas how to do this?
I've looked everywhere and I can't find a clear solution.
This solution needs to work on all three browsers : FireFox / IE / Safari!
You can't, there is no such event that will be triggered when someone exits the site. That's why in the early 2000s someone too clever invented "pop-unders": popups that will open immediately, but will be put on the background, behind the browser's window.
Which are one of the most annoying things on the web, and the first ones that any popup blocker or antivirus will kill :) On the other side, there are legitimate uses for that, like most surveys you see (I got one from microsoft some days ago).
Never rely on popups, unless you are writing an intranet site, or one where you are sure all of your visitors will not have a popup blocker.