From parent window i am opening one pop up window. After success of pop up screen control should go to parent window but when i am trying the code below, parent window is coming first and child window is coming behind that screen.
function A(requestId)
{ //strong text
B();//it will open child window
c(); //after this i am trying to open parent window by calling this method here.
}
function B() {
var childWindowId = "v";
var flowExecutionUrl = '#{flowExecutionUrl}';
var contentUrl = something;
var parentCallbackFunction = null;
var destroyOnClose = true;
cwmManager.create(childWindowId, draggable, title, helpMenu, width, height, windowContentClass, windowTitleClass, windowTitleImageClass,
closeIcon, windowBorder, suppressScrolling, modal, callbackFunction, contentId, contentUrl,
parentCallbackFunction, destroyOnClose);
cwmManager.open(childWindowId);
return true;
}
please help me through this.
open the new window using width & height using following code from parent window :-
function myFunction() {var myWindow = window.open("", "", "width=200,height=100");
after success the pass the data to parent window
Related
This is my function. I want to open a new window with the below URL and pass these parameters.
function viewWeightAge() {
var userNIC = document.getElementById("NICNo");
var childName = document.getElementById("childName");
window.location.href = "https://localhost:8080/KiddieCare/AdminPanel/WeightAgeGraph.jsp?childName="+childName+"&userNIC="+userNIC;
}
can anyone explain me the error?
Question Updated.
function showWeightAge(){
var userNIC = document.getElementById("NICNo");
var childName = document.getElementById("childName");
var parameters= userNIC,childName;
window.open ('https://localhost:8080/KiddieCare/AdminPanel/WeightAgeGraph.jsp','Window Name',parameters);
}
I Have tried. It's an open new Window. Like this
using window.open() I can open a window but I want to send parameters to the new JSP.
Instead of using window.location.href which change the url of the current window
you should use window.open()
https://www.w3schools.com/jsref/met_win_open.asp
Note that it could be blocked as an unwanted popup
In your case it can be done as
function viewWeightAge() {
const userNIC = document.getElementById("NICNo");
const childName = document.getElementById("childName");
window.open("https://localhost:8080/KiddieCare/AdminPanel/WeightAgeGraph.jsp?childName="+childName+"&userNIC="+userNIC);
}
I have a requirement tp popup a window display a pdf page, perform silent print and close the same.
String s =
"var win = window.open('PrintPopUp.jsf','_blank',\"height=300,width=200,scrollbars=no," +
"status=no, resizable=no, screenx=0, screeny=0\");" +
"win.onclick= function(){ win.close();}"
I used the above code to get the popup , on click of print I write this code to my page and the following to call a servlet to generate the pdf;
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
RequestDispatcher dispatcher = request.getRequestDispatcher("/hisprintservlet");
My question is this, I have been able to bring up the window, perform silent print but no matter what I do the popup wont close.
I am using IE 11 and the project uses ADF 12c.
Please help..
Checkout the docs on Popups here.
function showPopup(event)
{
event.cancel();
var source = event.getSource();
var popupid="popup";
var popup = AdfPage.PAGE.findComponentByAbsoluteId(popupId);
if (!popup.isPopupVisible())
{
var hints = {};
hints[AdfRichPopup.HINT_LAUNCH_ID] = source.getClientId();
hints[AdfRichPopup.HINT_ALIGN_ID] = source.getClientId();
hints[AdfRichPopup.HINT_ALIGN] = AdfRichPopup.ALIGN_AFTER_START;
popup.show(hints);
}
}
function hidePopup(event)
{
event.cancel();
var source = event.getSource();
var popupId = source.getProperty("popupId");
var isCanceled = source.getProperty("isCanceled");
var popup = AdfPage.PAGE.findComponentByAbsoluteId(popupId);
if (popup.isPopupVisible())
{
if (isCanceled)
popup.cancel();
else
popup.hide();
}
}
...
...
Hello World!
...
...
I found a solution for this.. i added an iframe to my popup window. In the body tag I added the followingg code to close ..
function test(win){if(win==null){alert('null');} else {setTimeout(function(win){this.close();},3000);}}
This works well in IE11
When someone requests a chat, an entry is made in the database. I have an hidden iframe on our dashboard that checks the database every 20 seconds to see if there is a chat and if there is it launches a popup window. Even if the popup is open the iframe still refreshes the popup every 20 seconds. Want I am trying to achieve is a javascript to check the status of the popup. If it is closed I want it to reopen it... if it is open then it bring it into focus... but I dont want the popup to refresh.. as I have an ajax script doing this..
Here is my code:
<script language="javascript" type="text/javascript">
function myOpenWindow(winURL, winName, winFeatures, winObj)
{
var theWin;
if (winObj != null)
{
if (!winObj.closed)
{
winObj.focus();
return winObj;
}
}
else
{
theWin = window.open(winURL, winName, winFeatures);
return theWin;
}
}
</script>
<% IF ChatSessionID <> "" THEN %>
<script language="javascript" type="text/javascript">
var gmyWin = null;
window.onload = function()
{
var w = 900;
var h = 500;
var l = (screen.width-w)/2;
var t = (screen.height-h)/2;
var params = 'status=0,resizable=0,scrollbars=0,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t;
gmyWin = myOpenWindow("/chat/chat_window.asp?ChatSession=<%=ChatSessionID%>&id=3", "myWin", params, gmyWin)
}
</script>
<% END IF %>
Any help you could provide would be greatly appreciated..
Best Regards,
Paul
I am not sure, but I believe if you name the window (e.g. myWin) when you call window.open, then later call window.open again using the same name, it will return the existing window if its already open or open/re-open the window and return a handle to that.
Edit
Ah, there you go -- from window.open:
If a window with the name
strWindowName already exists, then,
instead of opening a new window,
strUrl is loaded into the existing
window. In this case the return value
of the method is the existing window
and strWindowFeatures is ignored.
Providing an empty string for strUrl
is a way to get a reference to an open
window by its name without changing
the window's location. If you want to
open a new window on every call of
window.open(), you should use the
special value _blank for
strWindowName.
I believe according to the above mentioned specs, this might work:
var hChatWindow = window.open("", "ChatWindow", "whatever features"); // url intentionally left blank
// hChatWindow now contains a reference to new, existing or re-opened window
hChatWindow.focus();
if (hChatWindow.location=="about:blank") { // not sure; you need to experiment here
hChatWindow.location = "/chat/chat_window.asp?whatever";
}
Demo here, source here.
Register a callback on gmyWin.onunload.
You will find it tricky to subvert "block pop-up windows" in most browsers. However, if it is disabled, the following will work.
Main window:
var status = false;
function winOpen(){
window.open("child.html");
}
function winStatus(){
alert(status);
}
Pop-up window:
window.opener.status = true;
window.onblur = window.focus;
window.onunload = function(){
window.opener.status = false;
};
I am trying to open a window and then redirecting the original page to a new location. It opens the window, however before redirecting the parent page, it closes the new window too. How can I fix that
function orderPrint() {
var n = new Object();
n. ID = <?php echo $ID->ID; ?>;
n.action = posttothispage.php";
n.target = popWinCenterScreen("/common/html/empty.htm", parseInt(window.screen.height * 0.8), 796, "resize");
myFuction.PostRequest(n);
window.location = “someotherpagethanthis.php”;
}
Try using the onbeforeunload method to trigger the redirect before the opened window closes.
https://developer.mozilla.org/en/DOM/window.onbeforeunload
I have a main window (#1) on my webpage from which I open a new browser window (#2) from which I open a new window (#3).
Now if my user closes window#2 before window#3, I have the problem that window#3 no longer can call function in its window.opener since it has gone away.
What I would like to do is to set window#3.opener to window#1 when window#2 closes.
I've tried to do this i window#2 (by the way I use jquery):
var children = [];
$(window).unload( function( ) {
$.each( children, function( p, win ) {
if ( win ) {
win.opener = window.opener;
}
} );
} );
When window#3 is loaded I add the window to the array children in window#2.
But still when window#2 is closed before window#3, windows#3's window.opener doesn't point to window#1.
How do I make sure that my grand child window (window#3), can still call the main window (window#1) after window#2 is closed?
In the third wndow you put in:
<script type="text/javascript">
var grandMother = null;
window.onload = function(){
grandMother = window.opener.opener;
}
</script>
Thus you have the handle to the grandmother-window, and you can then use it for anything directly:
if(grandMother)
grandMother.document.getElementById("myDiv").firstChild.nodeValue ="Greetings from your grandchild !-";
window.opener probably is read-only. I'd setup your own property to refer to the grandparent when grandchild is loaded.
function onLoad() {
window.grandparent = window.opener.opener;
}
You should create a reference to the main window when the third opens:
parent = window.opener.opener
This will survive the second window closing.
var main_window = get_main_window();
function get_main_window(){
var w = window;
while(w.opener !== null){
w = w.opener;
}
return w;
}
This may be tangential, but why do you need to open 3 separate windows? Can you use a jQuery dialog instead? I get very frustrated when apps open windows on me.