Sangeet Shah
Sangeet Shah

Reputation: 3097

Any way to prevent external jQuery or javascript code in website

Try to prevent third party script from my webpage.

How to stop this external unwanted script code from my webpage.

I try many scripts to prevent it but nothing helpful for me.

Upvotes: 0

Views: 137

Answers (2)

Scription
Scription

Reputation: 645

if the link to the external site is on a page you can access then you can use jQuery to achieve this.

For example: if the link to the external site look something like this

<a id='externalLinkID' href='http://www.ExteranlSite.com'>Link To External Site</a>

then when the page loads you can write.

$("#externalLinkID").removeAttr("href")

Upvotes: 1

Leo
Leo

Reputation: 14850

in my website have add automatic footer link of Hosting site

This is a bit confusing because if you actually put the link, you should be able to remove it manually from your HTML. However, if the link it's auto-generated by your hosting company then FIRST you have to make sure you're not violating any terms and condition by removing the link. Some services offer free website designs but you have to display some attribution in your site...one of those is wix.com

Now, if you are sure you can legally remove the link, you could use the css's display property to hide it. However, this might not work if the link is added by a script that overrides this property, in this case you will need to using javascript to hide this element/link

Upvotes: 1

Related Questions