开发者

Deleting scripts interfering with each other in <head> tag

开发者 https://www.devze.com 2023-03-14 19:30 出处:网络
I have a script that is prevented from functioning due to the other scripts in thetag 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 m

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>//'
0

精彩评论

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