0
私はWPF
のWebBrowserコントロールにJavaScriptコードを追加しています。 JavaScriptコードでは、Object.freeze()
という関数を使用しています。これは、アプリケーションを実行すると、次のエラーが表示されます。 WebBrowserコントロールとWPF WebbrowserコントロールがJavaScriptコードを追加しましたが、Object.freeze関数がサポートされていません
マイの.xamlは次のようになります。
<Window x:Class="TestWPFApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TestWPFApp"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<WebBrowser x:Name="ProgressBarWeb" HorizontalAlignment="Left" Height="300" VerticalAlignment="Top" Width="300"/>
</Grid>
</Window>
そして、私のHTMLとJavaScriptのコードが
public MainWindow()
{
InitializeComponent();
//Js Code is a extract but the effect is the same
var html = "<html><head><script>" +
"var platformtypes = {"Attr1": 0, "Attr2": 1};" +
"Object.freeze(platformtypes);" +
"</script></head><body></body></html>"
ProgressBarWeb.NavigateToString(html);
}
私の質問は今NavigateToString()
機能が追加されます。
- どのインタプリタのVisual Studio 2017は、JavaScriptコードを解釈するために使用していますか?
- インタープリタを変更/更新する可能性はありますか?
- 他に何かお見逃しですか?あなたの助けのための
感謝。
を使用するコードに追加:空白のスクリプトが別のWebページに移動しようとしていることを示しているが。 JavaScript Freezeを実行して文字列を渡したいとします。 – jdweng