prevent google spider from reading specific javascript

autodream

Regular Member
Joined
Aug 17, 2017
Messages
241
Reaction score
35
hello guys
i want a code or method to prevent google spider from reading specific javascript
how can i do that?
 
Add the following (?js_resource=true) at the end of your JS link in the HTML page:

Code:
<script type="text/javascript" src="/scriptname.js?js_resource=true"></script>

Then in robots.txt add the following:

Code:
Disallow: /*.js?js_resource
 
Add the following (?js_resource=true) at the end of your JS link in the HTML page:

Code:
<script type="text/javascript" src="/scriptname.js?js_resource=true"></script>

Then in robots.txt add the following:

Code:
Disallow: /*.js?js_resource

thank you
and if in the script itself where to add the code
?js_resource=true
 
and if in the script itself where to add the code

I don't believe you can add it inside the script itself as the robots.txt works on the file name, not the contents inside.
 
Back
Top