2012-09-15 13 views
5

を呼び出すためには、私が使用しようとしていますコードです。C#.NET OpenWebKitSharp 4 - 私はここでは、.NET 4</p> <p>でのWinFormsからOpenWebKitSharpを使用してJavaScriptを呼び出すようにしようとしていますどのようにJavaScriptの

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 
using WebKit; 
using WebKit.Interop; 
using WebKit.JSCore; 
using webkitForm.Properties; 

namespace webkitForm 
{ 
    public partial class Form1 : Form 
    { 

     WebKitBrowser webKitSharpBrowser = new WebKitBrowser(); 

     public Form1() 
     { 
      InitializeComponent(); 

      this.Controls.Add(webKitSharpBrowser); 
      webKitSharpBrowser.Width = 600; 
      webKitSharpBrowser.Height = 400; 


     } 


     private void button1_Click(object sender, EventArgs e) 
     { 
      webKitSharpBrowser.Preferences.AllowPlugins = true; 
      webKitSharpBrowser.UseJavaScript = true; 
      webKitSharpBrowser.Navigate("http://sandbox.icontact.com"); 


      webKitSharpBrowser.GetScriptManager.EvaluateScript("alert('An alert from C#!');"); //Call javascript? 

     } 

    } 
} 

私は何かのために射撃することができません...私が紛失しているものがなければなりません。

ありがとうございます。

あなたが関数を呼び出し、.NET 4を使用している場合は可能です使用して::

<webkitbrowser>.GetScriptManager.CallFunction("name", new Object[] { arg1, arg2, ...}); 

あなたであれば、それはあなたが望むように行うことができないよう

+0

まあ答えがQUEであることが表示されますstion。ハム警告がトグルしなかった理由は私には謎ですが、他のjavascriptはうまく動作します..私はこの質問のために誰かが私に信用を与えていたのかと疑問に思った。 –

答えて

3

まあ、それはそうですあなたが使用できる.NET 2を使用したい:

<webkitbrowser>.StringByEvaluatingJavaScriptFromString("name(arguments)") 

- Open Webkit Sharp Issues

関連する問題