Opening Bookmark Dialog from Javascript - javascript

The way I did it before with window.sidebar.addPanel() does not work for latest version of Firefox. I try to use PlacesUIUtils.showBookmarkDialog as adviced in How to call for Firefox bookmark dialog?
It is (in the advice) preceded by Components.utils.import("resource:///modules/PlacesUIUtils.jsm");
The problem is that documents tell that .import() may be called only on (local) file. I want the thing to work for a casual user (without requiring any plugins preinstalled).
Is this approach usable in general? Can I not import from elsewhere? Any other suggestions?

See https://support.mozilla.org/en-US/questions/985670 - the answer I got there is basically NOT IT IS NOT POSSIBLE to implement opening the Bookmarks Dialog in Firefox. So I have followed a simplified solution (though valid across browsers).

Related

Navigate command

I have a page which unfortunately uses the old JavaScript command "navigate" (used to redirect to another page) instead of the currently used "location". There is unfortunately no way for me to change the code so I'm left with having to use IE, which is a problem for example on my PC at home, where I have Linux.
Browsers like Chrome or FF refuse to execute this and show "navigate not defined" in the console. Just out of curiosity, can anyone think of any way how to overcome this? Maybe some extension or possibility to teach the browser custom commands? I tried searching for this but didnt find anything. But before I completely resign I thought I would ask here.
Thanks in advance

Maximize the browser using Typescript

In my Angualr2 application, i am using Typescript. I need to maximize the browser when the app is get to run. I have seen this. So in javascript it can be done with
window.moveTo(0, 0);
window.resizeTo(screen.width, screen.height)
but i don't know, how i can access to the window object in the typescript?
TypeScript is just a superset of JavaScript so any valid JavaScript is valid TypeScript.
First off, you mentioned installing jQuery. The code you linked to doesn't use jQuery so I don't understand why you would need it.
Second: window.resizeTo does not work in most cases. Unless you're making a pop-up, it's unlikely it will work at all. In fact, I just tested it in Chrome, Edge, Firerfox, and IE11. IE is the only one which worked.

Open a Internet explorer/Firefox etc window with Chrome

I'm building a smaller Web Builder with Javascript and I want the user to be available to preview their page in all the major browsers. Because that the tool only is available for Chrome I need them to get the chance to open a Internet explorer window with the same information, and the same for Firefox and Opera and Safari... Is there a way to do so, in Javascript?
P.S. The information that should appear on in the window is stored in a variable.
If JS can call firefox.exe, it could also call nasty_trojan.exe. The best you can do is generate a custom link server-side, and say "paste this link into your other browsers.
Unless you'd like to be really fancy, in which case you need to render the pages server-side, ala http://browsershots.org/.
There's a chance it could be done if you wrote it as a chrome extension, because those have some measure of trust, but the JS on a page stays very much inside its sandbox.
This doesn't belong on the answers, but I did not see how to comment (I am new, sorry!). This may help. It seems you may need to use a java applet, at least, I'm seeing that in a few places. Hope I've helped!

Can I force a link to open in a specific browser?

I have designed a website using Firefox and am now looking to integrate a softphone into the webpage, but unfortunately it is made with ActiveX, so Firefox won't support it.
I have tried opening my page in IE9, and it looks a mess because I've used CSS3 for a lot of it and haven't coded it for different browsers because we will only be using Firefox within the office.
Is there a way that I can tell my page in Firefox to specifically open a new page in Internet Explorer and just have the softphone in there? Or is there a way to get ActiveX running in Firefox with a plugin or something?
You can open a link in Microsoft Edge from any browser by adding microsoft-edge: in front of the url in the HREF.
EDGE (works)
I don't know how to get it to work in other browsers though. My team and I spent quite a bit of time on it and couldn't find a raw HTML/JavaScript solution.
I don't think you can open a IE window from firefox, but you can easily build a firefox plugin based on your activex using http://code.google.com/p/ff-activex-host/
It really depends on your exact situation.
If you are targeting multiple users outside a corporate network this is hardly possible to achieve. However, if you are targeting your company's network it's possible to do this using custom protocol.
Your link then would look like: ie://opens_in_ie.com
You'll have to make changes to registry of target computers though. More info about custom protocols is available here: http://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx
In most cases, system administrator can do this remotely.
IETab V2 will let you open a tab within Firefox that runs the IE engine.
Once installed, you can force a link to open with IE by formatting the URL or bookmark like this:
chrome://ietab2/content/reloaded.html?url=http://domain.com
It's somewhat specific, but I created an internal site at work, and I wanted to link to another internal site that only works in IE. To do this, I created/defined my own application protocol in the registry. Then I added to my links the protocol header. This is similar to what apple does when you click a link and it opens iTunes. The downside to this approach, however, is that users will have to install the registry modification for it to work... like I said, it's really a solution for a very specific scenario.
Same answer as from chuck wallace
If you want to start from for example in Internet Explorer, go to C:\Program Files\Internet Explorer\iexplore.exe and create a shortcut to the Desktop.
When you check the properties from this created shortcut, you will see the Target: C:\Program Files\Internet Explorer\iexplore.exe.
Now you can place the shortcut from the website, behind the Target. It will show something like this: C:\Program Files\Internet Explorer\iexplore.exe www.nu.nl. Or this C:\Program Files\Internet Explorer\iexplore.exe https://stackoverflow.com.
This way it opens IE first and then the website.

Javascript to open multiple tabs in single browser

Does anyone know how to open multiple URL's in a single browser.
Instead of opening multiple windows, I want the urls to open in tabs in IE.
I am trying to approach this using JavaScript.
This strictly is a user preference in the browser and never try to override that.
For actual browser tabs, the only thing you can do is add the target="_blank" attribute to links. This may open tabs, but it may open windows instead. It's a user preference, like phoenix said. (By the way, Firefox, Chrome and Opera all opens "blank" targets in tabs by default.)
The other solution is to use Javascript tabs within the page itself. If you use jQuery, there are some plugins mentioned on this article I just read. Otherwise, do a bit of Googling for pure JS solutions.
What about if it's Internet Explorer only?
Also, Greg's original question was about JavaScript but would it be possible to make a simple ActiveX/.NET object that could do this and you could call from JavaScript and pass URL as a parameter?
You can say "never try to override that" but if the user is in a closed environment in which the browser us under control of the administrator, then the user has no choice. Browsers are used for much more than the web. A browser on a corporate site does not belong to the user, it belongs to the corporation.

Categories

Resources