none
Script warning in WPF WebBrowser

    Question

  • Hi there I want a great HTML editor in WPF. So for this what I did is that I added a WebBrowser to WPF window and navigated it to the html page with the TinyMCE html editor in it. However when I rin the  app, the browser control shows the script warning as follows:

    XAML

    <Window x:Class="TinyMceWpf.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525" >
        <Grid>
            <WebBrowser Name="webBrowser1" Margin="0,0,0,54" />
            <Button Content="Get Html" Height="31" HorizontalAlignment="Left" Margin="22,0,0,17" Name="btnGetHtml" VerticalAlignment="Bottom" Width="108" Click="btnGetHtml_Click" />
        </Grid>
    </Window>

    CS

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    
    namespace TinyMceWpf
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
                webBrowser1.Navigate(new Uri(@"C:\Users\MAHESH\Desktop\TechNode\WPF\MytTechDos\TinyMceWpf\TinyMceWpf\TinyMceWpf\edit.html"));
            }
    
            private void btnGetHtml_Click(object sender, RoutedEventArgs e)
            {
                string editHtml = this.webBrowser1.InvokeScript("getContent").ToString();
                MessageBox.Show(editHtml);
            }
        }
    }

    What can I do. Please help. Thank you.

    Thursday, April 05, 2012 8:13 AM

Answers

  • Hi Mahesh999,

    I understand Browser throw a script warning when WebBrowser navigate to html file, right?

    Once you alow script in your Browser, do this warning repro?

    In my opinion, the root cause of this waring is your Browser configuration.

    If you have alow script in Browser the problem still exist, please feel free to let me know.

    I'll go throug it once again to help you find the root cause of your issue.

    Have a nice day. 


    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, April 11, 2012 7:24 AM

All replies

  • Hi Mahesh999,

    I understand Browser throw a script warning when WebBrowser navigate to html file, right?

    Once you alow script in your Browser, do this warning repro?

    In my opinion, the root cause of this waring is your Browser configuration.

    If you have alow script in Browser the problem still exist, please feel free to let me know.

    I'll go throug it once again to help you find the root cause of your issue.

    Have a nice day. 


    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, April 11, 2012 7:24 AM
  • Hi Mahesh999,

    Any updates?


    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us

    Monday, April 16, 2012 7:17 PM
  • We are temporarily marking this as "Answer", if you have any concerns or new findings; please feel free to let me know.
    Best regards.


    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us


    Thursday, April 26, 2012 5:29 AM
  • How could this post be closed as answered? just because the OP did not response in time? I doubt if the moderator has verified the provided solution before posting it here.


    nothing is impossiable for a willing heart

    Thursday, March 07, 2013 10:01 AM