Render Html + Javascript in a .Net headless browser -


there need render html page simple javascript using headless browser in .net c# (server side) application. need rendered html source code.

i think can use .free/opensource libraries rendering such as:

awesomium

geckofx

cefsharp

berkelium

requirement example:

html code before render:

<!doctype html> <html> <head>     <title>test</title>     <meta charset="utf-8" />     <script type="text/javascript">         function formatcurrency(value) {             document.write(value.tolocalestring('en-us', { style: 'decimal', minimumfractiondigits: 2, maximumfractiondigits: 2 }));         }     </script> </head> <body>     <h1>example</h1>     <table>         <tr>             <td>price:</td>             <td><script>formatcurrency(275)</script></td>         </tr>     </table> </body> </html> 

html code after render: (expected result)

<!doctype html> <html> <head>     <title>test</title>     <meta charset="utf-8" />     <script type="text/javascript">         function formatcurrency(value) {             document.write(value.tolocalestring('en-us', { style: 'decimal', minimumfractiondigits: 2, maximumfractiondigits: 2 }));         }     </script> </head> <body>     <h1>example</h1>     <table >         <tr>             <td>price</td>             <td>275.00</td>         </tr>     </table> </body> </html> 

the difference javascript code <td><script>formatcurrency(275)</script></td> rendered <td>275.00</td>.

could me achieve requirement adding sample code? feel free use free .net browser control library in sample code.

note: can pass either html code or url rendering method. need implement this in server side, think should strict headless browser.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -