Hello guys! First of all two things:
1. Happy New Year to everyone, wish you tons of good, let this year bring you all only positive emotions and expectations!
2. typeof(Santa) is myth
so, here is my problem. i need a regular expression which cuts any javascript from the page html code. i mean only scripts between <script> and </script> tags, not the inline javascript.
i wrote the function which disables scripts:
but i would like to fully remove this stuff from the html. i'm using JQuery $.get() and i need to remove scripts from the returned data before any manipulations with it, because i put a portion of the returned data into a temporary div to be able to search through its elements and i do not need scripts in there.Code:function noscripts(content){var s_path_1=/<script/ig,s_path_2=/\/script>/ig;content=content.replace(s_path_1,'<!--script').replace(s_path_2,'script-->');return content;}
i tried to use this onesometimes it matches but sometimes it does not. can anybody help? thanks in advanceCode:/<\s*script[^>]*>[\w\W\s]*<\s*\/script>/ig;![]()



Reply With Quote
Bookmarks