G
Guest
I've come across a problem with the Webbrowser control that I am hoping some
of you folks might be able to help me with. FWIW, I am using VB.Net in Visual
Studio 2005.
On my company's website, we have a situation where a new window is opened
(in this case, we actually use ShowModalDialog to open the new window, but
using window.open seems to have the same problem).
The new window has a form on it. the target of that form is the original
page. Amazingly, this seems to work ok. Here is some sample code:
On the first page, we a bit of javascript like this...
<pre>
// set the windows's name
window.name = 'origPage';
// the function to open the window
function popupModal(url)
{
window.showModalDialog(url, window);
}
</pre>
then later on, there is a link to open the secondary page:
<pre>
<a href="javascriptopupModal('pageTwo.aspx');">Click here to open a new
modal page</a>
</pre>
On the secondary page (pageTwo.aspx), we have a form tag like this:
<pre>
<form name="form1" id="form1" action="Default.aspx" target="origPage"
method="post">
</pre>
So the Target attribute is pointing back to the original page. As I
mentioned before, this works ok when everything is done in a web browser.
The problem occurs when I try to use the web browser control instead of a
proper web browser.
The original page opens up fine, and the new window pops ok. When I try to
submit to the parent. Rather than the page in the webbrowser control being
reloaded, a new window opens up instead (with the same page as the one in the
webbrowser control).
I know that pageTwo can "talk" to the original one in the webbrowser
control. As a test a put a button pageTwo.aspx that looks like this:
<pre>
<input type="button" value="reload opener"
onclick="javascriptpener.window.location.reload();" />
</pre>
The javascript works find and makes the original window reload.
I went a bit further, and added the following to the code behind of the form
hosting the webbrowser control.
<pre>
Me.WebBrowser1.Document.Window.Name = "origPage"
</pre>
(I put that in the Navigating even handler).
Still no luck.
Short of rewriting the html so that it doesn't pull this trick, is there
anything that I can do?
thanks,
Doug
of you folks might be able to help me with. FWIW, I am using VB.Net in Visual
Studio 2005.
On my company's website, we have a situation where a new window is opened
(in this case, we actually use ShowModalDialog to open the new window, but
using window.open seems to have the same problem).
The new window has a form on it. the target of that form is the original
page. Amazingly, this seems to work ok. Here is some sample code:
On the first page, we a bit of javascript like this...
<pre>
// set the windows's name
window.name = 'origPage';
// the function to open the window
function popupModal(url)
{
window.showModalDialog(url, window);
}
</pre>
then later on, there is a link to open the secondary page:
<pre>
<a href="javascriptopupModal('pageTwo.aspx');">Click here to open a new
modal page</a>
</pre>
On the secondary page (pageTwo.aspx), we have a form tag like this:
<pre>
<form name="form1" id="form1" action="Default.aspx" target="origPage"
method="post">
</pre>
So the Target attribute is pointing back to the original page. As I
mentioned before, this works ok when everything is done in a web browser.
The problem occurs when I try to use the web browser control instead of a
proper web browser.
The original page opens up fine, and the new window pops ok. When I try to
submit to the parent. Rather than the page in the webbrowser control being
reloaded, a new window opens up instead (with the same page as the one in the
webbrowser control).
I know that pageTwo can "talk" to the original one in the webbrowser
control. As a test a put a button pageTwo.aspx that looks like this:
<pre>
<input type="button" value="reload opener"
onclick="javascriptpener.window.location.reload();" />
</pre>
The javascript works find and makes the original window reload.
I went a bit further, and added the following to the code behind of the form
hosting the webbrowser control.
<pre>
Me.WebBrowser1.Document.Window.Name = "origPage"
</pre>
(I put that in the Navigating even handler).
Still no luck.
Short of rewriting the html so that it doesn't pull this trick, is there
anything that I can do?
thanks,
Doug