Google Custom Search (or Alternative) in XHML
Are you really using XHTML like XML ( application/xhtml+xml
)? If not, you don't have to worry about it. document.write
will still work in mode text/html
, although of course this is bad practice.
If you are indeed using native XHTML ... well, I suspect you might have more trouble than just document.write
, as there are quite a few things that can run scripts when they didn't expect them to run in XHTML. But you can hack this problem by sabotaging document.write
.
The simplest method would be something like:
document.write= function(s) {
document.getElementById('placetoputwrittenstuff').innerHTML= s;
};
however, you will need to mess around more if it tries to write tags <script>
(since setting them via innerHTML
does not execute them, you will have to select them with getElementsByTagName
and run each one manually), or partial bits of elements in different calls write
(in which case you will have to collect strings and glue them together when complete).
a source to share