I always come to stackoverflow to check for answers; however, I have not yet found any relevant information on the current issue.
I have a PDA for mobile Windows 6.1, and I want to create a simple HTML page for it. I want certain page divs to have a certain height based on the text that is inside these divs.
- Maximum I want 2 lines of text.
- The text may contain HTML code. I want to cut the text, but it won't hurt the HTML.
Before you think: "There are 100 different CSS or Javascript solutions for this." I would like to mention that 6.1 uses a mixture of IE4 with some IE5 features. The browser only supports CCS1 (therefore max-height, no overflow: hidden, no position: absolute, no top, bottom, etc.).
The browser also supports a very limited set of Javascript features. I decided to analyze the Javascript DOM and constantly check if the text inside the div is larger than 28pt (these are two lines) and cut it. However, most DOM functions do not work. createElement () is not working, appendChild. Only getElementById and innerHTML work.
I found this solution https://code.google.com/p/cut-html-string/ for Javascript, which works great with modern browsers as it contains features like createElement (), appendChild (), cloneNode () etc. It does not work with IE4. The workaround for createElement () is innerHTML, which works fine, but then the browser reports errors for the DOM functions that the code uses.
PS: Please do not answer "change PDA, etc.". I know that the OS is very old, but I have to use it.
source share