开发者

prevent IE to tamper with page code?

Is it possible to prevent IE (7 or 8) to chang开发者_高级运维e the underlying code of a page ? My page, built with Dreamweaver, consists of a table with 5 images; each of these is a link to a larger size one. In FF or Chrome, the page displays exactly as planned. In IE, only the first image displays. All other have the "broken img" icon. The code revealed by F12 shows that IE adds the property complete="complete" after the first image.


Looks like the first image has not been closed correctly. Where you have:

<img src="images/sponsor.jpg" alt="aresti" width="200" height="80" longdesc="aresti-modelisme.com";

Remove the ; and replace with />


You can't change how IE renders, but you can adjust your code such that it's rendering engine handles your code better. I believe that complete="complete" deal has to do with the onreadystate that each element has in the IE DOM.

Could you provide the markup that causes red x's in IE? Did you check to make sure your markup was valid and everything? Are you doing any scripting?


Secondly, no you can't prevent IE or other browsers from "changing" the underlying code, because the code you see in the developer toolbar (or in Firebug with Firefox, etc) is not the HTML code, but is produced from the DOM, which is the structure the browser stores in memory after it has decoded the page and converted it into a set of objects it can render. The code you're seeing is that rendered version then being converted back into raw HTML.

The DOM may contain the defalt values for any attributes you didn't specify, and will also contain "corrected" HTML in the event that the actual input HTML has bugs. Depending on the browser, you may also find all your tags converted to upper case or lower case.

You can minimise the problem by using the W3C Validator (http://validator.w3.org/) to check that your HTML code is valid. Fixing the bugs that are picked up here will make your code match the expectations of the DOM, so it won't get changed so much. It will also eliminate a lot of the odd cross-browser rendering issues.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜