0

I want to use onload() or onerror() or any other Javascript event handler with:

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

For example:

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

Is it possible? If yes then can anyone help me? I am trying to do this but its not working.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Mushti
  • 13
  • 1
  • 2

1 Answers1

0

You cant do that I think as your real attribute. Your best bet is fetching something.here content. Or using PHP GET to send data to next page and use PHP if isset, you can not use event handlers from one page to other (maybe you could resort of using cookie or local storage on click but that is overkill of you ask me). When your new page loads its new show.

For example using ?get to send and fetch with JS:

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

And when new page loads:

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
    };

Or use PHP:

<?php 
if (isset($_GET['author'])) {
// do somehing
} ?>
ikiK
  • 6,328
  • 4
  • 20
  • 40