1

I have a Spring app running on localhost:8080. On this app, window.getSelection returns null. I thought that it might be a Javascript library that might be reassigning it, but I checked and I can't find anything. I created another page (a bare-bones one) that has nothing on it, and that page is also behaving the same way.

I also have a regular webserver running on this machine, and so I decided to try it there, only to see the same behavior.

I then tried to accessing the page from outside my network, using the hostname associated with my dynamic IP. This also gave me the same behavior.

However, every other page (i.e., normal webpages that are not hosted on this machine) that I open with the browser is behaving properly and returning a non-null value.

I checked this out in Firefox and thankfully it seems to work there. I'm curious as to why I'm seeing this behavior though. Does Chrome institute some security measures when it notices that you're hitting localhost?

4

1 回答 1

2

我解决了这个问题。似乎Better Pop Up Blocker扩展重新定义window.getSelectionnull. 当我将我的网站添加到“允许”列表时,我能够看到null.window.getSelection

于 2013-06-02T18:09:00.217 回答