473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Open a file in google chrome with cmd without swapping to the new tab

5 Nibble
I'm new here and I'm looking for help, I found this way to open files on google chrome with java:


private void abrirVideo(String archivo) {
File arch = new File(archivo);
String comando = "cmd.exe /c start chrome \"" + (archivo) + "\"";
try {
String s = arch.getParent();
Runtime.getRuntime().exec(comando, null, new File(s));
} catch (Exception ex) {
System.out.println("Error abriendo archivo: " + archivo + "\n" + ex);
}
}


and it does work fine, it opens the file in the same window, but the problem I have is that it automatically swaps chrome to the new tab, I've been looking for a couple days on the web and I don't see any post about this. Is there a way to open those files (like pictures, videos, etc...) in chrome in a new tab, without automatically swapping to that new tab. Thank you for your help.
Dec 22 '20 #1
3 3642
dev7060
636 Expert 512MB
and it does work fine, it opens the file in the same window, but the problem I have is that it automatically swaps chrome to the new tab, I've been looking for a couple days on the web and I don't see any post about this. Is there a way to open those files (like pictures, videos, etc...) in chrome in a new tab, without automatically swapping to that new tab. Thank you for your help.
What does 'swap' signify here? Switching of the active tab?
Dec 22 '20 #2
Ariiza13
5 Nibble
Yes. It switches the active tab to that new tab.
I couldn't find any way to do it so i had to use this chrome extension to force chrome to never switch to new tabs:
https://chrome.google.com/webstore/d...ajdbikelkdcmcl
But that solution could stop working in the future, so if you know any way to do it in the code itself i'll be really thankful.
Jan 12 '21 #3
dev7060
636 Expert 512MB
Command-line switches and flags may prove useful. Refer to the documentation.
Jan 12 '21 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: wpjoju | last post by:
i have this code which adds an event listener to a newly opened window but it doesn't seem to work in google chrome. the problem is window.addEventListener seem to work in chrome but if you do...
0
by: catoblepa80 | last post by:
How can i read all google chrome bookmarks and place it into a list or a dictionary? i think the best way is to use regular expressions on the chrome bookmarks file, can you help me to accomplish...
3
KeredDrahcir
by: KeredDrahcir | last post by:
Can anyone help me. I don't know if this is a mysql, php or Google Chrome error. I have a login form but for some reason I'm getting an error when I use Google Chrome. It used to work in all...
2
by: peridian | last post by:
Hi, If I use php to echo an XML file directly to the response, all I see is the XML text. This is because Google Chrome comments out the XML declaration at the start of the text, causing it to...
4
KeredDrahcir
by: KeredDrahcir | last post by:
I'm using a url type as an input box so that the keypad will be optimised for people to enter a web address on mobile devices. It doesn't allow them to enter it without http at the front but I...
0
by: neovantage | last post by:
Hi all, I am unable to control z-index in Google chrome. here is the URL of my work http://www.contourinteriors.com.au/ I am using SuckerTree UL menus in my navigation. When i move over any...
0
KeredDrahcir
by: KeredDrahcir | last post by:
I have a box that need to display when the user clicks on a link. I want the background to grey out while the box is active. I found some code to do this using main CSS and little bit of JavaScript....
1
by: jlellis | last post by:
I want to be able to "Edit" a file instead of the file opening up in the browser. It was actually doing the same thing in Mozilla and IE, but I was able to fix the issue with those two browsers, but...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.