将配置数据从webview传递到app

时间:2014-01-31 13:38:07

标签: android ios xml webview naming

我希望将一些配置数据从webview传递到应用程序。我认为最好的方法是链接到包含所有信息的文件。将链接添加到Web视图页面的最佳方法是什么?

类似于:

<head>
  <meta name="my-app-config" content="http://my-app-ulr.com/config.xml">
</head>

适合应用阅读?或者我应该在标题中使用自定义元素,以便在需要时传递更多数据,例如:

<head>
  <my-app type="config">http://my-app-ulr.com/config.xml"</my-app>
</head>

从应用程序中读取Web视图内容是否有优势?

1 个答案:

答案 0 :(得分:0)

我之前使用meta标签做过这个,没有要报告的问题。但是,我以这种方式构建它:

<meta name="my-app-properties" content="things of interest to my app" my-app-config="http://my-app-ulr.com/config.xml" my-other-property="more things">

这对我来说似乎更具可读性,并为您提供了轻松添加和阅读更多属性的空间

相关问题