I have a problem with js popup window.
I open a popup and try to access its elements in another page page, no success, and I don't want to reload the popup source, I simply want access a element of the opened popup
Ex -
1st page - opened popup with html5 music player
2nd page - need to pause the music when user click on button on main page
1st page
var popup = window.open("test.html","mypopup","width=500,height=300");
2nd page I want to access mypopup windows elements without reloading the popup
I only need the way how to access opened popup elements without interrupting its sources using JS or JQuery
Same origin (domain, port and protocol)?
Plain JS:
from page1
var popup = window.open("test.html","mypopup","width=500,height=300");
popup.document.getElementById("player").someFunction();
from page 2
var popup = window.open('','mypopup');
// now popup is known again
popup.document.getElementById("player").someFunction();
Related
Lets say I have a javascript popup window (opened using var popup = window.open()), that is pointing to the same domain.
How can I detect each time a page is loaded from the page that opened the popup (eg. after a link is clicked on or a form is submitted) o I can check if the user performed an action? Bonus points if I can get the url and response code for the page (that is loaded in the popup).
I'd also like to note I would not like to rely on the loaded page within the popup to provide information (by firing events).
I would like to know how can i refresh/reload parent window from an iframe on submit without closing the frame using javascript / jquery.
Parent window contains Display table and Button that opens an Iframe.
Iframe contains a form which on submit saves data in the table which is displayed on parent window.
At present data is not displayed until i refresh the page manually.
please Suggest me a method to do so.
This is the scenario
main window has a buttton called form ,
on clicking it an Iframe Opens ,
Iframe has a Form which on submit saves data,
this data is displayed in a table on the main window.
But when I do submit data is saved but not displayed.
I want a method so that My Main window is refreshed / reloaded without having to close the Iframe and refreshing it manually
Please suggest a solution to this problem ...don't offer any other method..
This thing is Not Possible Parent window cannot be refreshed keeping open the I-frame
I am currently working on a project where i can open a child window anywhere within the site, to display order details relating to the logged in user. On one of the pages i need to refresh the data when the window is closed. I have worked out how to refresh the data if the window is closed and the window was opened on that page. The issue i am having is if the child window was opened on a different page and the user navigated to the page that requires it to refresh once the window is shut, i need to obtain the reference to the open child window so i can call my javascript that causes the data to refresh, if the child window is shut.
First its seen little bit tricky..
you declare some ajax function to send information to server whether child window opened or not.. if child window opened then refresh page.
for E.g .
-> assume that user opened 2 same page In different tabs1 and tab2.
-> user opened opened popup window on tab2 and add/change some information..
-> tab2 content refresh as per ur event.
you should also send a one flag to server with session id and tab1 continuous check is that any changes happed to server it will be refresh..
I was able to solve the issue i was having using the code from the following link
Obtain reference to existing browser window
You can open child window with javascript like this.
window.open("ChildWindowURL.aspx?source=windowA");
In the Page_Load of child, you can get the source.
string action = Request.QueryString["source"];
You can send this value to client side with hidden value, and when child window is closed, do refresh or what you need.
I'm using a colorbox to create a popup window that displays some dynamic content (using Coldfusion).
I would like to refresh this data, based on some selections by the user within the window.
Within my colorbox window I'm trying this:
<a id="selectLink" class='ajax' href="index.cfm?event=abc&sort=123" onclick="$.colorbox.close();">
This unfortunately only closes the current colorbox window, then directs the browser to a regular window.
Any ideas?
I have a question on javascript window management.
My application opens an iframe which displays a link. Clicking on the link, opens a popup window, in which I enter my login credentials. My intention is to close the popup window after the login credentials are entered. And this I have been able to achieve using a JS call to self.close().
There after my server side script does some more processing and would like to display the results back in the iframe. This is where things break for me.
The overall flow is as follows:
Iframe Displays a Link --> Clicking on the Link Pops up a window --> Popup Window closes after credentials are entered --> I see my original iframe now (How do I display the contents back in the iframe). Here is the code snippet that closes the popup.
5
6 self.close();
7
The parent of the popup is the iframe. If I modify the above script to give the focus back to its parent, which in my case will be the iframe, will that suffice? Or am I issing something here?
you can access the iframe from your popup by using opener. for example this will reload your iframe:
<script type="text/javascript">
opener.location.href = "htp://mypage.com/myiframe.php";
</script>
you just have to add the right parameters to show what you want to. (of course you have to do this before your self.close();)