open popup in alreadily open pop up window - javascript

My jsp application has one home page and that has so many anchors <a> for accessing different pages using AJAX.
one anchor is for creating user which opens a particular user registration window using javascript window.open of size 1050*600.
at end of use r registration i am providing two anchors :
1. for displaying preview of registered info and
2. for taking print out of registered info.
both are of size 500*200 and again I am calling javscript window.open() to open these two windows.
but it's not they are taking same size as that of parent pop up (ie.1050*600).
how to open pop-up in alreadily open pop-up window?

where do you have print preview ? in the register page itself ? if yes then you can use window.resizeTo in your print preview page to reset to the size you want, ideally its
window.resizeTo(500,200); in your case

Related

Open a window and share it among tabs?

I have a page that uses window.open() with a window name to pop up another window that will act as a presentation screen for my app:
window.open(url, 'my-presentation-win', 'resizable');
Now, that works well, and if I trigger that action, and then navigate to a different page, but then come back to the original page and trigger the action again, it brings the original popup window back into focus (the name is honored).
However, if I load the same HTML page in two different browser tabs (Chrome on OSX), and trigger that action in each, I end up with two different windows (each presumably with the name my-presentation-win?). Is there a way for that window to be re-used, when its used by the same app running in different tabs?
I don't think it's possible :(
Access a window by window name

Google Chrome blocks ajax requests when print preview modal is opened on child window (How to Workaround?)

Problem:
Google Chrome blocks ajax requests when print preview modal is opened on child window
Details:
I have a web page - ParentPage.html with a link to child page - PrintPage.html
a href="PrintPage.html" target="_blank"
Then on my PrintPage.html I have JavaScript that invoke window.print()
$(document).ready(function() {
window.print();
}
If user goes to ParentPage.html without closing that print modal on PrintPage.html and click some button that fires Ajax calls, they are blocked until the print modal is closed.
This should be a known problem with Google Chrome, other browsers(IE, Firefox) have similar issue but they don't become problem because they simply don't allow user to navigate to other tab other than the current opened print page.
I found related questions here on SO but no solution:
Chrome browser unable to make a server call when print preview is opened
Google Chrome blocks ajax requests when print preview is opened on child window
It would be best to make the parent window's Ajax not blocked. I feel it might be possible because not all tab's Ajax calls are blocked, only this parent window. So if there's a way to make the child page - PrintPage.html not a child page of ParentPage.html, that would work.
A less ideal way would be to close the print modal on PrintPage.html when I detect user clicking on ParentPage.html. Then reopen the print modal when PrintPage.html is focused. The reopen modal part is easy, but I don't know how to close print modal from a different tab.
If above two ways won't work, I think I'll have to display a warning when the print modal is opened and user is trying to click ajax call button at ParentPage.html. Detecting if the print modal is opened from ParentPage.html might not be easy either.
Any help would be appreciated!

How can I keep my popup focused?

I have created a couple of pages whose content will be displayed in a pop up window.
I have a page where I define 3 links:
Page1<br />
Page2<br />
Page3
When clicking on the link, I have a popup displayed. But when clicking on another link, the popup is minimized. I need to keep it opened and display appropriate content from another page.
Unfortunately, I cannot use any javascript functions to focus my popup, since I need to put the links onto another vendor's website, that allows only simple html to be copied over, so when someone else will click the link, popup will open appropriate content.
Is there any way to achieve that with what I currently have?

Open a completely new window with JavaScript without replacing the contents of the previous window

I have a page with several links that open a separate window with varying content. My goal is to open a window for each and every such link using JavaScript. My problem is as follows:
let's assume:
- i have two links on the page, lnkDoWorkOne and lnkDoWorkTwo
- lnkDoWorkOne opens a window with url = WorkOne.aspx which in turn does some work upon loading
- lnkDoWorkTwo opens a window with url = WorkTwo.aspx which also does some work
In my present solution when I click lnkDoWorkOne then a new window opens with WorkOne.aspx and works just fine. Then when I click lnkDoWorkTwo, then there's no new window at all but the contents of the previously opened window are simply replaced by WorkTwo.aspx. I need to have BOTH windows open with WorkOne.aspx and WorkTwo.aspx so that the user can view the contents in parallel.
Does anyone know how to achieve this?
Are you giving the same window name to the both window.open calls? If so, change the name of the window and you should get two separate windows.
window.open('WorkOne.aspx', 'window1');
...
window.open('WorkTwo.aspx', 'window2');

How to open print-preview page upon clicking on hyperlink?

Every browser has print preview command in their File menu I want to make "print" button on HTML page and upon clicking i want to open print preview page. is this possible?
With this we can open print options
Print this page
but can we open print-preview page instead print options ?
window.print() is the only print-related function in window.
However, if you have defined a dedicated css-file for print, you can create a page that simulates a print-preview by only using the print stylesheet. And then open this in a popup or new window.
No you can't. However there is a way to show that in IE by using ActiveX and some others for other browsers...

Categories

Resources