Question: Can I use JavaScript, or any other non-server script, to read a web page? I'd like my local HTML file (with JavaScript code) to read a internal web page, which is hosted on a web server, and get its entire source code. 

I tried XMLHttpRequest, but I am facing cross-domain issue. Any solution to this? Or any other non-server script that I can use? I already have a few JavaScript functions that I'd be using so want to use your suggested solution and my existing JavaScript code together.

Answer: 
Looks like you are having *leading* or *trailing* *whitespaces* in your `classname`. 

Try using this: -

```
if(classname.trim().equals("edit_body"))

```

This will trim any of those whitespaces at the ends.
Firstly, `String.equals()` is NOT broken. It works for *millions* of other programs / programmers. This is NOT the cause of your problems (unless you or someone has deliberately modified ... and broken your Java installation ...)

So why can two apparently equal strings compare as unequal?

1. There could be leading or trailing whitespace characters on the String.
2. There could be embedded non-printing characters.
3. There could be pairs Unicode characters that *look* the same when you display them with a typical font, but in fact are not the same. For instance the Greek code page contains characters that look by Latin vowels ... but are in fact different codes, and hence are not equal.