I have a script that is prevented from functioning due to the other scripts in the tag of most of the webpages that I saved on my disk (about 5). It seems the only way the script can function is if I manually delete the contents of the tag (effectively taking out the scripts), inserting the custom script, saving the file, and then running it. Is there a way I could delete all the con开发者_如何学JAVAtents of the tag before they are loaded, or if I could delete the contents, save the page, and reload it with the custom script?
<html>
<head>
<script type="text/javascript">'want to remove this</script>
<script type="text/javascript">'want to remove this also</script>
<script type="text/javascript">'want this to run after deleting scripts</script>
<title>'want to keep this'</title>
</head>
<body>
This has nothing to do with jQuery. You need to write a simple sed/awk script to remove the tags that you want. Provide more details on what you want to remove and also what OS you're using. Edit : On a linux system something like this would do the trick
sed 's/<script type="text/javascript">What you want removed</script>//'
精彩评论