0

When I access top.location.hostname through a userscript or Firefox add-on, I get the following in the Error Console:

Error: Permission denied to access property 'hostname'

What is the problem with this and how to over come?

Edit:
alert(location.hostname) gives multiple alerts for a single webpage (may be, because of frames in a page).

So, I tried with top.location.hostname. It is giving correct output but with an error in error console. How to skip the error?

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
Mmh
  • 399
  • 1
  • 5
  • 16
  • That code won't work from a cross-domain iframe, but this question needs a whole lot more detail! Give us a recipe to duplicate the problem, at a minimum. – Brock Adams Aug 06 '13 at 11:12
  • var host=top.location.hostname; console.log("host: "+host); this is my simple userscript. It is displaying correct output in log and above mentioned error in console. – Mmh Aug 06 '13 at 11:17

0 Answers0