Hey there, guys,
I’ve got this issue: our server puts out some nonsense tags before the <html> tag and I’ve got to find a way to detect for which specific nonsense exists on the page. I know it’s a hack, but it’s necessary.
I found a means, by using document.body.parentNode.innerHTML which works on FireFox but I can’t find code that will work on both FireFox and IE.
This is what I came up with:
[CODE]<script type=”text/javascript”>
//This script corrects the layout of the page on the discrepancy checking page for post-shipping.
var pageContents = document.body.parentNode.innerHTML;
if ((pageContents.indexOf(“TemKey SP:10038 PN:2”) != -1) && (pageContents.indexOf(“TemKey SP:10038 PN:2”) < 100)) {
document.write(“XXSomethingXX”);
// alert(pageContents.indexOf(“TemKey SP:10038 PN:2”));
// alert(pageContents.slice(0,100));
}
</script>
As you can guess, I’m looking for “<!– TemKey SP:10039 PN:2” in the space before the <html> tag of the document.
This JavaScript exists in the footer of the page where the document.write needs to produce certain text.
The second part of the if-then statement (the part that asks if its less than 100) is so that on pages where TemKey isn’t high above the <html> tag, the Script won’t be ‘true’ given that it will detect that condition in itself at the bottom of the page.
Ideas?
Yours,
Sylvan (Dave)