tags:

views:

171

answers:

2

I'm working on an internal tool, and I recall there being some way to make your script prompt for elevated permissions, and if accepted, allowing cross site requests etc...As this is an internal tool, this may accomplish something I need.

Does anyone know how to do this?

To elaborate, I'm actually trying to read (in javascript) the contents of 3rd party tracking iframes injected into our page, to give some performance analytic information. These iframes are obviously from a different domain. If I were to proxy them, they would no longer give accurate information, so that option is out.

+1  A: 

I don't think you can actually make your script ask for elevated permission, but you can check for it and ask the user to change his browser security level if needed.

Mozilla.org has an interesting article about configurable security policies : http://www.mozilla.org/projects/security/components/ConfigPolicy.html

If you only need to bypass the same origin policy, you could use other tricks, e.g. a server-side proxy.

Wookai
Accepting this as it was the best advice given.
FlySwat
flyswat - here is better advice -> try learning how and why javascript operates with the permissions that it does. if javascript was not in a sandbox, your box could get hacked just by visiting a website.
+1  A: 

For Firefox/Mozilla, I think you mean netscape.security.PrivilegeManager.enablePrivilege() like in this other question.

You'll need the UniversalBrowserRead privilege to allow cross-site AJAX. (I've used it to build a set of local files for a simple stock-ticker page that grabs data from Yahoo's Finance service. The browser asks you (the user) the first time you run the browser on that page whether you want to grant the privilege. You don't have to grant it again until you restart the browser and read the same page again.)

Jason S
Yeah, that only works in a hosted enviroment if the script is signed, and I can't do that for a couple other reasons.
FlySwat