简体   繁体   中英

Html5 javascript and css with Xamarin

I am writing a native cross platform application using Xamarin forms. But i am having one page with a Web view where i need to render an existing HTML5 page. The existing HTML 5 page have JavaScript and Css as well . I wanted to port these files in Xamarin forms application instead of hosting in a Server.How can i solve this scenario?

Thanks in Advance

Note

I am aware that we can use Razor engine to load HTML.But seems it is not working with HTML5 js and css combination.

Ask yourself how complex are each of the possible solutions (a) short-term and (b) long-term:

  • Write brand new code in XF
  • Use WebView to show a static copy of your HTML
  • Use WebView to show a your remote page
  • Open a link to your page in Safari

The list above starts with high upfront cost and ends with lowest upfront cost, the long term cost can vary significantly: do you want to update your app whenever your web page's design changes; is the web page fairly complex; will you be using it for tracking users;.... the list goes on.

Without specifics it's hard to guess what's the best way to deal with your issue.

Assuming it's really a toss-up I'd go with XF all the way, re-implement that page's functionality in XAML because it will allow future development to be self-contained - you should reduce the code's dependencies as much as possible, that includes dependencies that don't show up compile-time. It can be painful for a team to maintain an app when they depend on another team to fix/update something.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM