将NFC标签直接读入浏览器窗口

时间:2015-06-30 08:21:28

标签: javascript php html nfc

我正在开发一个应用程序,该应用程序读取NFC标记并将ID转移到Web应用程序的搜索查询中。

目前唯一的方法是在标记上包含整个网址,例如example.com/search?=tagid

当用droid设备扫描标签时,只需将浏览器打开到该网址即可。

无论如何,我只能将tagid写入NFC标签,并且必须在ID中说自动填充浏览器中的表单字段?

我环顾四周但似乎找不到任何东西。以为我会问这里。

网络应用程序是用PHP和javascript编写的。

由于

2 个答案:

答案 0 :(得分:3)

我花了一整天处理这个问题,所以我觉得有必要分享我的解决方案。

我使用两个应用程序。用于编程NFC标签的NFC工具,以及用于进行输入的Tasker。 NFC工具可以对标签进行编程以调用Tasker任务。在Tasker中,我有一项任务是将数据写入当前活动的任何字段。应该是浏览器和语言无关。

另外,在我的情况下,我使用剪贴板作为缓冲区,因此我不需要编写一堆Tasker任务。您将数据编程到标记中,将其放入剪贴板,然后Tasker就为您执行粘贴。

答案 1 :(得分:1)

The phone OS decides what to do with the data on the NFC tag, depending of the type of data. If the phone finds a URL, it opens the browser with that URL (unless a local app on the phone has registered for that URL).

If you like to store only the ID, maybe because the URL is very long, then you can create a dedicated app for the phone, that creates the URL on the fly once it receives the ID, and then launches the browser.

If the space for the URL is to small for your URL, you may consider a URL shortcut, such as tinurl (tinyurl.com).