Note that there are some explanatory texts on larger screens.

plurals
  1. POWebBrowser control does not work with some javascript constructs
    primarykey
    data
    text
    <p>i have found that WebBrowser control (both Winforms and WPF) has certain javascript constructs not supported especially when they are rendered using showModalDialog / showModelessDialog calls....</p> <p>This is easily reproducible...</p> <p>1) Create a test html page such as <code>C:\Temp\Test.htm</code> with this code..</p> <pre><code> &lt;input type=button onclick="showModalDialog('C:\\Temp\\Test.htm');" value="Show Me as Modal Page." /&gt; &lt;BR /&gt; &lt;a href="javascript:alert('I am shown.')"&gt; I should work using href. &lt;/a&gt; &lt;BR /&gt; &lt;a href="#" onclick="javascript:alert('I am shown.')"&gt; I should work using onclick. &lt;/a&gt; </code></pre> <p>If you load the page above using the IE browser, both hyperlinks should work. Now in the IE browser, if you you click the "Show Me as Modal Page." button, the same page opens as MSHTML dialog window and again on that both hyperlinks work.</p> <p>This is expected.</p> <p>2) Now create a <code>WPF</code> or <code>WinForm</code> app hosting <code>WebBrowser</code> control sourced to "C:\Temp\Test.htm"</p> <pre><code> &lt;WebBrowser Source="C:\Temp\Test.htm" Height="500" Width="500"/&gt; </code></pre> <p>If you run the app and load the test page using the <code>WebBrowser</code> control, both hyperlinks will work on the loaded page. </p> <p><strong>But</strong> if you load the modal window using the "Show Me as Modal Page." button, then the modal window <strong>fails</strong> to alert using the first hyperlink i.e. <strong><code>I should work using href.</code></strong> does not appear.</p> <p>Second hyperlink works as expected.</p> <p>Do you guys reckon is there a workaround for the first hyperlink to work? </p> <p>In my case I have no access to the page's content that I am loading using the <code>javascript:showModalDialog()</code> call, so the issue fix is intended from the web browser's perspective.</p> <p><strong>EDIT</strong></p> <p>They say that <strong><code>FEATURE_SCRIPTURL_MITIGATION</code></strong> has to be enabled for this. But it is already enabled in my registry. The MSDN continues to say ...</p> <blockquote> <p>By default, this feature is enabled for Internet Explorer and disabled for applications hosting the <strong>WebBrowser</strong> Control. It has to be manually enabled for <strong>webBrowser</strong> control.</p> </blockquote> <p>How to enable this for the web browser control?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload