Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a MVC application, I have button on this application (lets call this web site as "A"). On the click of
that button , I am opening another website(lets call this web site as "B") in new tab(This is not my website, I don't know internal implementation of this website)
I have below issues,
1) I will be showing loading image on website "A" tab until user works on Website "B" . I want to continue with my website (web site "A") when tab with website "B" is closed.
So how will I come to know when another tab is closed?
2) On submit of website B it will call Action method of web site A. But then anything I write in this action method is getting executed in second tab.
How can I make it run in initial browser tab?

What I have tried:

I have tried to catch tab close by OnBeforeUnload of javascript but as in tab 2 there is totally separate application I am not able to notify tab close to application (as I cant change the code of 2nd application)
Posted
Comments
Sergey Alexandrovich Kryukov 12-Feb-16 11:43am    
Bad idea... Why? What are you trying to achieve, ultimately?
—SA
Black Mamba Elapidae 14-Feb-16 23:14pm    
I know it is a bad idea . But as I mentioned already website B is not in my control and it is already designed to work in this way. this site B can be opened with HttpPost with some json data. user is supposed to select data in site B and it will send that data to site A (target url is already sent in initial request json)

1 solution

1) You can't know this

2) I don't understand how it is calling an action on your site when you say the sites are not connected. Anyway you can do this if you give the browser tab A a name, and the form on site B needs to set the "target" of it's form to be the name of tab a, and it *should* submit to that tab, but this might not work on all browsers, and as you don't own site B I don't see how you can make this change.

I can't see you ever getting this to work, cross-site interaction is usually limited deliberately in browsers for security reasons.
 
Share this answer
 
Comments
Black Mamba Elapidae 12-Feb-16 5:50am    
Thanks for quick response.
The website B I am mentioning is a courier website and they post the selected data on exposed url, that is how application B is calling action method of my application . :)
Sergey Alexandrovich Kryukov 12-Feb-16 11:44am    
Aren't you concerned with server push? Then the approach can be totally different. Your goals are still unclear though...
—SA
Black Mamba Elapidae 14-Feb-16 23:20pm    
I am not sure what are you suggesting with server push.. Please refer my comment on main thread ..
Sergey Alexandrovich Kryukov 14-Feb-16 23:51pm    
Well, it's always useful to read and learn what is server push ("push technology" vs "pull technology"), this is one of the most fundamental issues of programming...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900