Trying to insert meta tag to head with custom script

I want to block search engine crawler, by my want, through custom script.

I searched for this, and I found that if I insert this tag to head, I can do it.

<meta name="robots" content="noindex">

So I tried these:

First try

var norobotmetatag = document.createElement('meta'); 
norobotmetatag.name = 'robots'; 
norobotmetatag.content = 'noindex'; 
document.head.appendChild(norobotmetatag);

Second try

var norobotmetatag = document.createElement('meta'); 
norobotmetatag.setAttribute('robots', 'noindex');
document.head.appendChild(norobotmetatag);

Third try

var norobotmetatag = document.createElement('meta'); 
norobotmetatag.setAttribute('name', 'robots');
norobotmetatag.setAttribute('content', 'noindex');
document.head.appendChild(norobotmetatag);

All try failed. I assume that this is prohibited act in writefreely now.

Am I right?

After this, I found Publicity setting, So I set the Publicity setting as Unlisted now.

But I want to know that is this technically possible.
For example, I may want to block some AI LLM crawler by similar way.

Thank you :D!

Most robots won’t run JavaScript, as far as I know. That’s the way it was in the 90s when the robots.txt was designed, anyhow, and I suspect that’s not the kind of thing they would have any reason to change.

Yes. So What I tryed was that inserting html element below, to head, by java script :slight_smile:

<meta name="robots" content="noindex">

How I check I success was, after modify and apply custom java script, seeing source code of my blog site. :slight_smile: