我如何在 具有rel =“ author”

问题描述 投票:0回答:1

我想将onload()onerror()或任何其他Javascript事件处理程序用于:

<link rel="author" href="http://something.here" />

例如:

<link rel="author" href="http://something.here" onload="alert(1)" />

有可能吗?如果是,那么有人可以帮助我吗?我正在尝试这样做,但是没有用。

javascript html dom-events onload onerror
1个回答
0
投票

我认为您不能做到这是您的真正属性。最好的选择是从这里获取内容。或使用PHP GET将数据发送到下一页并在使用isset的情况下使用PHP,就不能在一页之间使用事件处理程序(也许您可以在单击时使用cookie或本地存储,但这对您来说太过分了)。新页面加载新节目时。

例如,使用?get发送和获取JS:

<link rel="author" href="http://something.here?author=true" />

并且在加载新页面时:

var loc= window.location.href;
  //get loacation

values=loc.split('?');
link=values[values.length-1];
//split it at ? and get : `?author=true`


    if (value == "?author=true") {
       // do something
    };

或使用PHP:

<?php 
if (isset($_GET['author'])) {
// do somehing
} ?>
© www.soinside.com 2019 - 2024. All rights reserved.