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

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.

Related

Cannot print from a website provided Print link using CefSharp

A webpage has links to start a print job on it. Clicking the link initiates a new popup window and then immediately the print dialog is shown. The popup window is not rendered and if I click print, then a blank page is printed. It appears that the print dialog is blocking the popup from rendering the page first. If I cancel the print dialog the popup renders properly but now there is no print dialog.
The behavior is the same when using the CefSharp Winforms example.
Is this something I need to deal with? Can I dismiss the print dialog, let the page render and then call the dialog again?
The TargetURL of the popup is about:blank which does not give me much to go on that it is a print action. How does CefSharp tell you it has been asked to print something?
For people landing here from Google printing seems to be rather limited in CEF still and thus in CefSharp. See General Usage Printing and Silently Printing and also Kiosk Printing for example.
Also there is a PrintToPDF which I have not tried yet.
Looking at how Google Chrome does this it appears it renders the page to a PDF file and then shows this file in a popup/new tab. Of course they have then built their own silent printing as the next step.
Edit
Using cef_binary_3.3683.1920.g9f41a27_windows64_client with
No extra arguments
clicking exactly the same link
a popup window appears
the print window appears
the popup window navigates to display preview of what is to be printed
Print can be clicked to print the information viewed in the popup
Using CEFSharp Master WinForms version
No extra arguments (other than set by the example at startup)
clicking exactly the same link
a popup window appears
the print window appears
the popup window appears blocked and is blank.
Print can be clicked and it prints a beautiful white blank page.
AFTER print window closes the popup window navigates to the information to be printed.

Flex Accessiblity - Tab Focus goes out of flex app

In an accessible flex app, the user can navigate through the control by using the TAB key.
The flex app pops up on top of the html page aftert the user activate a particular link, and is loaded using swfobject.embedSWF.
It works well in most cases, but there are some instances where either or both these happen:
a) The flex app loads ok, the "flex focus" is set on the intro text label to read out loud, but pressing tab seems to still cycle through the links on the page behind. (Now Fixed, see Edit 2)
b) The focus worked well and pressing tab cycle through the controls ok, but after going through them it then tabs out of the flex app and onto the address bar.. it becomes a nightmare to even try to get back to the flex app without clicking on it.. which isn't exactly accessibility friendly.
Is there any way to prevent these from happening?
EDIT: The target browser is IE. Seems to be the most used with Jaws
EDIT: I managed to fix problem (a). The trick was to call focus on the swf object, but after a slight time out - must be something to do with flash/js ready state.
setTimeout(function(){
document.getElementById('swfobject').focus()
},25);
Problem (b) is still an issue though...
In your mx:Application component, add an event listener for the keyFocusChange and add this code :
protected function application1_keyFocusChangeHandler(event:FocusEvent):void
{
event.preventDefault();
focusManager.getNextFocusManagerComponent(event.shiftKey).setFocus();
}
b) Try to place some focusable element after swf in html. When focus leaves flex app, see if onfocus handler of that element gets called. If it is, you can refocus flex app from there or redirect it where you want.

navigateToURL ... set modal property

When a user clicks a button, I need a separate browser window to popup. How can I set the modal property of the application? (ie, when a popup window opens, the main application is disabled until that popup is closed ... I need to use a browser window rather than a popup window, but can't figure out how to disable the main application)
PopUpManager.createPopUp (this, navigateToURL( url, "http://www.google.com" ) , true );
thanks!
[[Updated Answer]]
Ok, my modal dialog looks like so:
cg = mx.managers.PopUpManager.createPopUp(this, ChoiceGrid, true) as ChoiceGrid;
PopUpManager.centerPopUp(cg);
But, what I would do instead of what you're asking, is embed an IFrame in the modal popup. This is exactly what we're doing in our app to collect CC data (well, not the popup part, just the IFrame bit. http://code.google.com/p/flex-iframe/
This way, you have the standard modal dialog you're looking for, AND an internally managed 'view' out to your checkout server. Something like this:
<code:IFrame id="iFrameWithJSfunctions"
src="{checkoutURL}" />
The flex-iframe is pretty easy to work with, for the most part. You shouldn't have many problems with it.
[[Original Answer]]
I'm not sure you need a PopUp to do this.
Why don't you simply do:
navigateToURL(urlRequest,"_blank");
instead?
You should think of a Flex App as a self contained entity. The PopUpManager is designed to create Windows (Panels / any UIComponent) that reside over another component inside the SWF. It does not create items that pop up out of the SWF or in new browser windows.
navigateToURL could be used to create a HTML pop-up from your Flex application. However, there is very little--if any--communication between the SWF and the browser pop up. And there is no way to make a modal pop-up.
You might investigate performing an ExternalInterface call and creating your new pop up in JavaScript. Here is an article about creating modal windows in JavaScript. Before going too far down that road, I would think carefully about your requirements. How would feel if one browser window popped open another browser window and prevented you from doing any browsing until you addressed the issues in that window. Or to put it another way, how would you feel if Microsoft Word opened a word document and wouldn't let you edit any other document until you shut down the first one? I'd be pretty upset.
Modal application dialogs are one thing. And the PopUpManager allows you to create those. I would consider Model application windows a bad UI decision.

How to Open Print Friendly Page Windows?

Our users can currently select a number of funds from a page and go to another page to see the funds compared on a chart. I now have to present the user with an option to produce a print-friendly fact sheet page for each fund in the chart.
The requirement is that each page will open in a new window (or tab), and be minimised so as not to be 'too intrusive' when they're opened. Can somebody suggest how I could go about this? This also means that the user will have to go to each window or tab to print the page.
They also want the print dialog box open in each of the new windows so the user doesn't have to open it. Is this possible, for the print dialog to open at the page load? If so, can somebody suggest how - JavaScript?
I disagree that (up to) 10 new windows can ever be anything but intrusive! Ideally I could send these new pages directly to the print queue. Is this possible?
Otherwise, I could Generate a page dynamically for each fund, strip out the contents of the page body and add the content for that fund to a large single page print-friendly factsheet. Does anyone have experience in this kind of work? Any pointers?
several points
you cant control new tabs vs new windows, this is a browser setting.
if its tabs, you can only have one print dialog per browser instance (depends on browser, but generally speaking). It tends to be modal.
you can call window.print() on page load to trigger the print dialog automatically, but its not very user-friendly
Whats the problem with creating a print friendly css and simply having a print button on the page that calls window.print();

window.open not working when attached on onload event in chrome and safari

I have attached some javascript on onload event of the form. this script contains window.open. Although this works fine in all the browsers window.open doesn't open a new window nor it gives nay error message in google chrome and firefox.
I want to first check the screen resolution if it is less than 1024 then I would open it in a new window without menu,toolbar and others so that the user has more space to work on.
This is a feature, not a bug! :)
remember back in the '90s when pop-up windows annoyed the crap out of everyone? Well, because of the MASSIVE abuse of that JavaScript behavior, now the only way to open windows is with direct user interaction; like a click.
If you have a legitimate reason for opening another window, attach a click event to a button labeled such that it properly indicates you'll be opening a window. If your user wants to open the window, they will do so, and it will correctly get past any but the stupidest popup blockers. If they don't want to, you should not be opening a window in the first place.

Resources