我刚刚开始使用java脚本,我想从URL中获取元数据...当在输入字段中输入任何URL时,它必须从中提取元数据,这是执行时在html java脚本中使用的基本用法代码抛出错误
我正在寻找任何替代方案,但没有任何帮助。请提供如何实现该功能的任何想法。
<!DOCTYPE html>
<html>
<body>
<head>
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML5,CSS,JavaScript">
<meta name="author" content="John Doe">
<meta content="http://stackoverflow.com/favicon.ico">
</head>
<p>Click the button to return the value of the content attribute of all meta elements.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = "https://www.amazon.in/"
// var x = document.getElementsByTagName("META");
var txt = "";
var i;
for (i = 0; i < x.length; i++) {
txt = txt + "Content of "+(i+1)+". meta tag: …Run Code Online (Sandbox Code Playgroud)