The property value for reading the href link through JavaScript is that IE sometimes reads the absolute path, while other standard browsers such as Firefox are the original path.
In IE, for the getattribute method of JavaScript, ie also provides the second parameter with values 0, 1 and 2. If the value is 2, the original path value is used. If the value is 1, the absolute path of the server is used.
Let's take a look at the Code:
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br/> <HTML xmlns = "http://www.w3.org/1999/xhtml"> <br/> <pead> <br/> <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8 "/> <br/> <title> untitled document </title> <br/> </pead> </P> <p> <body> <br /> <Div id = "test"> <a href = ".. /index. PHP "mce_href =" index. PHP "> test </a> </div> <Div id =" res Ult "> </div> <br/> <MCE: Script Type =" text/JavaScript "> <! -- <Br/> var test = document. getelementbyid ('test'); <br/> var link = test. getelementsbytagname ('A'); <br/> linkhref = link [0]. getattribute ('href '); <br/> alert (linkhref); <br/> linkhref = link [0]. getattribute ('href ', 0); <br/> alert (linkhref); <br/> linkhref = link [0]. getattribute ('href ', 1); <br/> alert (linkhref); <br/> linkhref = link [0]. getattribute ('href ', 2); <br/> alert (linkhref); </P> <p> // --> </MCE: SCRIPT> <br/> </body> <br/> </ptml> <br/>
Reference: http://www.planabc.net/2008/11/06/ie-href-bug/