سؤال

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?

هل كانت مفيدة؟

المحلول

I fixed the issue. It appears that the Better Pop Up Blocker extension redefines window.getSelection to be null. When I added my site to the "allowed" list, I was able to see a non-null value for window.getSelection.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top