Right now I'm using Process.Start(URL_Here) to open a new page in the web browser - it will either open a browser or a new tab if one is already running. I was wondering, is there any reasonable (i.e. the one which won't require any 'hacks') way to re-use already opened tabs? - by "re-use" I mean a situation when f.e. www.google.com is already opened, I want to open a google page again, but instead of opening a new google tab it will redirect to the one that is already opened. Thanks for any help.
This sounds like standard browser behavior, and it's unlikely you'll be able to change it with simple command line arguments.
If you're willing to use Chrome and give every piece of data you transmit to The Company of Great Evil, then here's a plugin that can reuse a tab if you're using the same URL.
Related
Edit: Thank you wOxxOm. It worked :)
chrome.tabs.move(XXX,{windowId:YYY, index:ZZZ})
Somehow I did not see the move option :(
I am writing simple Google Chrome web extension and I want to manipulate the tabs and windows. I actually want to be able to move a tab between the windows. The tab will have programatically spawned dynamic page, that I do not want to reload. The windowId is not listed in the modifiable properties chrome.tabs.
Am I missing something or it is currently not supported? What are the workarounds?
p.s. In extreme case also powershell or .Net might be acceptable (I have total control of the target PC). Currently spawning clearly distinguishable iframe over the web pages (background script injected and message listener) but the iframe gets reloaded, which I want to avoid.
p.p.s. Workaround might be to detect the currently active window and spawn new tab in the active window (if required), but this would require to save the page state, close the inactive tab and spown new one in the active window (this should be possible)
p.p.p.s. Main target is Google Chrome, but want it also for Microsoft Edge. Hopefully also for other browsers.
Edit: Thank you wOxxOm. It worked :)
chrome.tabs.move(XXX,{windowId:YYY, index:ZZZ})
Somehow I did not see the move option :(
I recently blocked quite a lot of ads across my entire network using AdGuard. Unfortunately, AdGuard does not prevent pop-up windows from opening. Although the advertising page is not called up, I get a popup which tells me that the requested page cannot be reached.
That's why I wanted to write a chrome extension that closes these popups automatically. Unfortunately, I fail to save the value of a checkbox in chrome.storage that is supposed to activate / deactivate the extension.
could someone help me here?
:EDIT
Okay i managed to store my value but now i'm running into the problem that i need to run a script when a page can't be loaded and i got no idea how i can do that. :S
Any Ideas? Is that even possible?
I'm frequently dealing with websites that open a bunch of new tabs with ads and I'm tired of it.
A while back I discovered AdCloseGold which is a Chrome extension that automatically closes all tabs that open a specified URL and I've happily used it for a while now.
Unfortunately, AdCloseGold has a few shortcomings:
1) No wildcards in the url
2) A limited amount of urls one can ad (because it stores the data in a Google account)
3) Doesn't close blank pages or page not found.
4) Doesn't have a button or something that says "add THIS page to auto close", meaning you have to copy and paste all urls manually into the list.
5) Doesn't provide any prewritten list of urls.
Recently I've started using the hosts file, redirecting urls to a nonsense address and then close that address through AdCloseGold, meaning I need just one address to auto close, but that has quite some problems as well, because the hosts file requires the full url, i.e. adding xyz.com to the hosts file doesn't redirect abc.xyz.com.
Furthermore, I do not really want to redirect all of these urls permanently but rather only in Chrome, so I can still access those pages through Firefox or IE.
I'm a (hobby) coder and I don't mind the work, I consider it more fun than work, but I only have some rudimentary knowledge of how to make a Chrome extension.
So the question is: Does a Chrome extension like an advanced AdCloseGold already exist and if not (I couldn't find any) where would I find a detailed enough tutorial for Chrome extensions, where I could learn this?
Author of Ad Close Gold here. I'm aware of the shortcoming you mentioned in your question. I've really wanted to add those to the add-on but never really can find the time to do so. I first created the add-on just for myself and it was fine for me. I thought I'd share the add-on with everyone since, even till this day, I cannot find any add-on that will auto-close tabs for me.
I have the source code for the add-on on github: https://github.com/mukunku/Ad-Close-Gold
Feel free to fork the repository and make any changes. You can create a separate add-on or merge the code back to my project if you like. If you merge the code back to mine, I can release it as a new version (And give you credit of course).
P.S. Wild cards are technically supported. If you use a regular expression as the URL and enable the IsRegEx option, it will work.
For example: www.ali.*.com
This will match all of the following:
www.aliexpress.com
www.aliother.com
www.ali.com
I want to add a button to my visual C++ form that will open with a specific browser. So far for links I've been using:
System::Diagnostics::Process::Start("UrlHere")
Which, as standard, opens with whatever your default browser is.
I'm wondering what the process would be to force the URL to open with a specific browser and if it's possible without the use of ShellExecute?
Edit - You are correct, this is C++/CLI. Removed the C++ Tag.
Edit Edit - Apologies if it came across as misleading. Some slight elaboration;
The buttons will launch to application URL's, some of which can only be used in Internet Explorer, others that CAN (and should) be used in Chrome. This is why I need to avoid using the default browser and have different buttons using different browsers when launching URLs
Before answering the 'how', I'd like to ask the question "should you be implementing this?"
By not launching the user's default browser, you are subverting the user's decision.
Perhaps the user prefers a particular interface, and is willing to live with the incorrect renderings that come with it.
Perhaps the user has a browser addon that they really need, such as a screen reader for the blind.
You are requiring additional software installed that the user may or may not want.
Perhaps the user doesn't want Chrome. Perhaps the user prefers FireFox.
You are saying that you know which browser is best, now and forever.
What if the next version of IE makes it work with the sites that are currently Chrome-only? What if the next version of Chrome fixes the sites that are currently IE-only?
What if the site changes so that it works in more browsers?
Do you go back and release a new version of your software that changes the browser for particular sites?
You're trying to solve a problem that may already be fixed.
Both Chrome and Firefox support a addon that will render a tab using the IE engine. It can be set to automatically activate when certain URLs are seen.
Perhaps there is a browser that already works with all your sites, that you don't know about.
Therefore, my recommendation is no, do not do this. The user has decided which browser they want to use, respect that decision and use the default browser.
That said, here's how you would do it: You could use the CreateProcess method, but you're in managed-land, so you might as well use it. Use the Process class to launch the new process for you.
Process^ browserProcess = gcnew Process();
browserProcess->StartInfo->UseShellExecute = false;
browserProcess->StartInfo->FileName = "C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe";
browserProcess->StartInfo->Arguments = "http://www.google.com";
browserProcess->Start();
I have a Chrome extension that opens a number of tabs, which it keeps open and uses to display data. I want those tabs to close when the extension is disabled or reloaded. My initial thought was that background.html would be unloaded when I restarted the plugin, but I can't seem to get anything that involves this to work. Any suggestions?
Chrome automatically closes pages with chrome-extension://<your_extension_id>/local.html urls (pages from the extension directory) when an extension is disabled. So if you can display your data using those pages - they will get closed. If it is some external site you are displaying - maybe you can make a local stub page with iframe and load your external site there.
Otherwise I can't think about any other way (besides having another extension watching this one).
i dont' know so much about chrome extensions, but, I think you are openning new windows by something like var w = window.open(params), so, you can close the window with w.close().
if not, ignore my answer :P