我在此处找到了此解决方案Form value creates a url,以便在提交时通过网址输入文字。
是否可以在网址中添加rel =“nofollow noopener noreferrer”和target =“_ blank”?
感谢
<script>
function process()
{
var url="http://name.com/" + document.getElementById("url").value;
location.href=url;
return false;
}
</script>
<form onSubmit="return process();">
URL: <input type="text" name="url" id="url"> <input type="submit" value="go">
</form>
答案 0 :(得分:0)
有两种方法可以在新窗口中打开提交响应页面/操作页面:
location.href
来电更改为window.open
来电;有关使用window.open ... OR
return true
将表单提交到操作网址或return false
以阻止提交。然后,也为表单操作指向的新页面设置nofollow行为,您可以在robots.txt中禁止其索引或添加元标记,如下面的答案中所述:https://webmasters.stackexchange.com/questions/13837/nofollow-in-a-form-action