Firstly, is it possible to access Firefox add-ons/extensions from JavaScript? If so, how to execute Multifox commands from JavaScript?
I'm trying to isolate sessions in Firefox so that more than one user can login to a website simultaneously. I found multifox as a solution but I don't know how to launch page with multifox support. Let me know if better option is available.
Related
I would like to make my browser faking the focus on multiple tabs/windows for testing purposes. I am testing pages that require the user focus (to be an active windows/tab). Is there a way to fake it? Different browser? Plugin? JavaScript code I can run from console? A use of the Selenium?
I would like to run the solution in multiple tabs/windows while I am doing other jobs on my pc - coding, browsing etc.
The preferable solution should work on Ubuntu, but Windows 10 is also acceptable (a cross-platform solution would be the best).
Note: else it would be nice to run without headless mode, so I can interact with content in some cases manully.
Short answer: No.
More explanations: https://sqa.stackexchange.com/questions/39547/selenium-how-to-prevent-a-just-started-chrome-window-from-receiving-focus
You could run this in a virtual machine to retain interactability without interrupting your work.
One of the requirements for the app i'm writing requires the application to work offline. For the app to function offline, i must write it's functionality in javascript, client side. There are some functions which the user shouldn't be able to see within developer tools. I'm using Angular 4 so the javascript code is already minified and uglified but the code can still be decoded.
The functions in question does some mathematical calculations.
My thought is to store the javascript functions within Indexeddb. Then the code cannot be read from the developer tools.
Is this a solution to hide JavaScript functions?
I know a keen user would be able to find a way to get into the Indexeddb on their machine. But it's better than nothing? right?
Indexeddb data can be viewed within Chrome, Firefox and Opera developer tools. Indexeddb is not a valid way of hiding javascript functions.
Is there any way IE can be closed programmatically?
I am trying to build a simple login system for the school I am working at in which a pupil would sign in using a HTML form and when they click the submit button the window will close automatically.
I have tried this using JavaScript (close() seems to be redundant now), VBScript (.Quit) and trying to run a .cmd file to close it externally (Windows Script Host). None of these have worked.
I am not doing this maliciously and I have absolutely no bad intentions of using this code. I understand that it is a universal standard for web browsers not to be closed by client/server side scripts. But, I am, nonetheless, wondering whether this would be possible and how (preferably without installing any other applications).
Is there any way IE can be closed programmatically?
Sure. Find the right IE instance in the SHELL.WINDOWS collection, then QUIT that instance. Or find the right process in Win32_Process, then TERMINATE that process. Or probably dozens of other ways.
None of which will necessarily help, unless you provide a ton more information about what you are actually doing! But that's the consequence of asking "Can I do 'X'?", instead of: "I need to achieve result 'Y', what is the best way to do that?"
You've told us 'X', but not 'Y'.
JavaScript cannot close windows that were not opened via JavaScript.
If websites could close people's browsers, a lot of people would be angry. Your non-malicious intent is unknown to the browser.
Internet Explorer stops the scripts to run.
How to allow javascript codes to run without showing this "This website is using a scripted window" in internet explorer?
Help me in advance.
Are you trying to use prompt()? If so, there's a setting in Internet Options to allow pages to use scripted windows to prompt for information.
You should't rely on prompt() anyway, really. Use a form.
You need to change your security settings in IE to allow JavaScript to run. The message is designed to warn users that JavaScript is being used. You can't disable this programmatically, since that would negate the whole purpose of the warning.
I'm writing a Firefox extension that needs to know what the username of the currently logged in user is in Windows, Mac, or Linux. So if I'm logged into my machine as "brh", it'll return "brh". Any idea how to do that from extension JavaScript?
Firefox extensions play by different rules to normal JavaScript running in the page: finding the current user is absolutely possible.
Open your Error Console (in Tools) and enter this:
Components.classes["#mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get('USER')
The environment variables Firefox was started with are available through that NsIEnvironment XPCOM component.
You may have to customise this per platform. If all else fails, you might be able to create an NsIFile in ~ then look at its .path; I'm not sure if shell expressions are honoured there, though...
The flagged correct answer works fine. I use this in our extension on Firefox 38. I also use events so that the page can communicate with the extension and retrieve windows properties from the extension.
getWindowsProperty: function(prop){
return Components.classes["#mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get(prop);
},
Don't think that's possible, seems like it would be a security hole if it were.
Yea, not possible... Javascript runs in a secure enviroment, and all FF extensions are javascript so you wont be able to be doing much interaction with the OS... but ill stick around to see if someone knows a way(it would be VERY cool...)