Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Removing Javascript

by joe++ (Friar)
on Jan 02, 2003 at 20:22 UTC ( [id://223845]=note: print w/replies, xml ) Need Help??


in reply to Removing Javascript

Hi Mur (Jeff?),

The problem here is - as always - the behaviour of some web browsers, that actually render the most crappy html/javascript code when they really shouldn't.

BTW, I'm intrpreting your second code example as being Javascript, rather than PHP (what it more looks like), so it would read like this:

<script language="Javascript"> document.write("Always use </script>!"); </script>
Anyway, in order to cope with this kind of crap I normally try a combination of HTML Tidy and/or LibXML's xmllint with the proper flags to accept and correct malformed html as input.

Then, if your source can be corrected this way and converted into well formed xhtml, you even can think of applying a very minimal XSLT stylesheet which leaves out all the <script/> elements.

(yes, I know, this has nothing to do with Perl, but this is how I solved this kind of problems many times already).

--
Cheers, Joe

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://223845]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-24 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found