When I try posting an answer by copying and pasting something with html formating from a browser the view results shows html code only. Example posting the following as an answer in the DW Answer section of my website.
The trick is give the focus to the WebBrowser component:
<span class="kwd" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #00008b; background: transparent;">procedure</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;"> TFormBrowserAdd</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">.</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">ButtonNavigateClick</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">(</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">Sender</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">:</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;"> TObject</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">);</span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #00008b; background: transparent;">begin</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">
WebBrowser</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">.</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">CanFocus </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">:=</span><span class="lit" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #800000; background: transparent;">True</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">
WebBrowser</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">.</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">Navigate</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">(</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">EditUrl</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">.</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">Text</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">);</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">
WebBrowser</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">.</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">SetFocus</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">;</span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #00008b; background: transparent;">end</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; color: #000000; background: transparent;">;</span>
But, after that the back key will not work correctly so you have to manage in other way. For example i have used a button on my form.
Test using “Ctrl + Shift + V” as suggested above.
The trick is give the focus to the WebBrowser component:
procedure TFormBrowserAdd.ButtonNavigateClick(Sender: TObject);
begin
WebBrowser.CanFocus := True;
WebBrowser.Navigate(EditUrl.Text);
WebBrowser.SetFocus;
end;
But, after that the back key will not work correctly so you have to manage in other way. For example i have used a button on my form.
So the combination works for you now?
Please login or Register to submit your answer
replied 10 years ago
The above html code when shown correctly should have read:
The trick is give the focus to the WebBrowser component:
procedure TFormBrowserAdd.ButtonNavigateClick(Sender: TObject);
begin
WebBrowser.CanFocus := True;
WebBrowser.Navigate(EditUrl.Text);
WebBrowser.SetFocus;
end;
But, after that the back key will not work correctly so you have to manage in other way. For example i have used a button on my form.