1

The thing is I have a page A.aspx there is script in that which will create a tab. from A I'm opening another page B.aspx .

What I want is when I click a button in B.aspx . The script in A.aspx should execute . or else the link in A.aspx which call that script should execute ..

3
  • huh? Is this supposed to be a question? Commented Feb 6, 2010 at 6:29
  • Why are you keep posting the same question over and over again? The first one was 20hours ago (stackoverflow.com/questions/2206376/…), then 1hour ago (stackoverflow.com/questions/2212151/…) and now again! Please read the FAQ for cases that you don't get the answer you were looking for (stackoverflow.com/faq). Commented Feb 6, 2010 at 6:34
  • He's having a lot of trouble stating the question clearly. I think he's just trying to say "how can I have page A redirect to page B and automatically execute function C?" I think. Commented Feb 6, 2010 at 8:36

4 Answers 4

1

you should not do this. It is insecure.

Sign up to request clarification or add additional context in comments.

Comments

0

I am not sure whether this is the solution for your question. You can issue a Server.Transfer to Page A from Page B and pass a context variable also. Check this context variable and then in the Page_Load event you can call the javascript function by using

ClientScript.RegisterClientScriptBlock method

Comments

0

if the calling window opened the called window just use the handle returned from the window.open. otherwise no dice.

Comments

0

First, you need a link to open the new window with a call to the window.open() function, passing it a URL and a target. Pass it '_blank' to inform the browser to use a new window:

Add this link within A.aspx:

<a href="#" onclick="window.open('B.html', '_blank'); return false;">
    New window
</a>

Second, you'll also need a reference to the new window's opener, which is the window which created the new window:

Add this code within B.aspx (please replace FUNCTION_NAME() with your function identifier) to call your parent window's function:

<script type="text/javascript">
    window.opener.FUNCTION_NAME(); // Call FUNCTION_NAME() within A.aspx.
</script>

You can also access window.opener.document to access the original window's DOM.

More information is available here:

Documentation for window.open() function

DOcumentation for window.opener object

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.