ndn-js
Version:
A JavaScript client library for Named Data Networking
58 lines (44 loc) • 2.07 kB
HTML
<!--
* Copyright (C) 2014-2019 Regents of the University of California.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* A copy of the GNU Lesser General Public License is in the file COPYING.
-->
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>NDN Interest Matches Name</title>
<script type="text/javascript" src="../../build/ndn.js"></script>
<script type="text/javascript">
function check(){
var interest = new Interest( new Name(document.getElementById('interest').value));
var nameToCheck = new Name(document.getElementById('nameToCheck').value);
var output = (interest.matchesName(nameToCheck) ? "matches" : "doesn't match");
document.getElementById('result').innerHTML = output;
}
</script>
</head>
<body >
<form>
Please enter the name of an interest:<br />
<input id="interest" type="text" name="INTEREST" value="//domain.com/ndn/ucla.edu" /> <br/>
Please enter a name to check if the interest matches the name:<br />
<input id="nameToCheck" type="text" name="NAME_TO_CHECK" value="/ndn/./ucla.edu/extra" /> <br/>
</form>
<button onclick="check()">Check</button>
<p id="result"></p>
</body>
</html>