shlomi gadol

shlomi gadol

  • 2k
  • 36
  • 43.1k

javascript script code doesn't work on c# webbrowser control

May 31 2015 5:02 AM
Hi,
I took from tradingview site this widget script and put it on my webbrowser control but it doesn't show nothing. This is the code from the site:
 
<!-- TradingView Widget BEGIN -->
<script type="text/javascript" src="https://d33t3vvu2t2yu5.cloudfront.net/tv.js"></script>
<script type="text/javascript">
new TradingView.widget({
"autosize": true,
"symbol": "AMEX:SPY",
"interval": "5",
"timezone": "exchange",
"theme": "Black",
"style": "1",
"toolbar_bg": "#f2f2f2",
"withdateranges": true,
"hide_side_toolbar": false,
"allow_symbol_change": true,
"hideideas": true,
"show_popup_button": true,
"popup_width": "1400",
"popup_height": "900"
});
</script>
<!-- TradingView Widget END -->
 
and this is what I wrote:
 
webBrowser3.AllowWebBrowserDrop = false;
webBrowser3.IsWebBrowserContextMenuEnabled = false;
webBrowser3.WebBrowserShortcutsEnabled = false;
webBrowser3.ObjectForScripting = this;
 
webBrowser3.DocumentText =
"<html><body><script type='text/javascript' src='https://d33t3vvu2t2yu5.cloudfront.net/tv.js' ></script>"+
"<script type='text/javascript' >"+
"new TradingView.widget({" +
" 'autosize': true," +
" 'symbol': 'AMEX:SPY'," +
" 'interval': '5'," +
" 'timezone': 'exchange'," +
" 'theme': 'Black'," +
" 'style': '1'," +
" 'toolbar_bg': '#f2f2f2'," +
" 'withdateranges': true," +
" 'hide_side_toolbar': false," +
" 'allow_symbol_change': true," +
" 'hideideas': true," +
" 'show_popup_button': true," +
" 'popup_width': '1400'," +
" 'popup_height': '900' });" +
"</script></body></html>";
 
If someone can help, it would be great
 
Thanks a lot
Shlomi

Answers (3)