开发者

Is there a way to block foreign javascript/bookmarklet execution from within a html page?

For example: Would it be possible to prevent the execution of a bookmarklet with the help of javascript?

Background: I'm testing Oracle Siebel with开发者_如何学C IE8 and since the new version, bookmarklets simply do not work. No feedback, no error. Verified on multiple clients. If running the code in question via script console, it works.

I believe Siebel might be blocking bookmarklets somehow due to security, but how?


That's not possible. Bookmarklets run in the context of the active website. Probably they simply changed something breaking the bookmarklet.


It is possible to detect changes in the DOM (see:http://stackoverflow.com/questions/3219758/detect-changes-in-the-dom).

But of course it is not 100% safe and there are tools like GreaseMonkey that inject Javascript in pages so basically you can only avoid something for the non-hackers amongst us... :)

Pinterest for instance can not be used on Facebook. If you want to block Pinterest from pinning your side, Pinterest even helps you and does not pin when it sees this in the head section of your page:

<meta name="pinterest" content="nopin" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜