I want to call the JavaScript function "Goto" like this:
javascript:Goto('DM_NEW_OBJECT.ASPX?DM_CAT_ID=2063&DM_PARENT_ID=2217&INPUTSELECTION=&DM_OBJECT_ID=0&PACK_ID=0&CASE_ID=0&mode=0&SITE=Default');
the function is located in the DefaultGeneral.aspx
page, and I need to call it from within a WebBrowser control:
webBrowser1.Navigate("http://mySite/DefaultGeneral.aspx");
Do you have any idea?
Since you are using a WebBrowser object, I will assume that this is actually a Windows forms question and not an asp.net question.
You should look at the InvokeScript function of the web browser.
Let's say your webpage has the following function:
WITHOUT PARAMETERS:
<script type="text/javascript">
// Function Without Parameters
function JavaScriptFunctionWithoutParameters() {
outputID.innerHTML = "JavaScript function called!";
}
</script>
You would want to call it the following way:
this.webBrowser.InvokeScript("JavaScriptFunctionWithoutParameters");
WITH PARAMETERS:
<script type="text/javascript">
// Function With Parameters
function Goto(someParameter) {
outputID.innerHTML = someParameter;
}
</script>
You would call it like this:
object[] param = new object[1];
param [0] = "DM_NEW_OBJECT.ASPX?DM_CAT_ID=2063&DM_PARENT_ID=2217&INPUTSELECTION=&DM_OBJECT_ID=0&PACK_ID=0&CASE_ID=0&mode=0&SITE=Default";
this.webBrowser1.Document.InvokeScript("Goto", param );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With