Navigate the default browser to a new URL in the same tab - browser

My program can open a URL in the default browser. It opens the default browser if its not already opened and navigate the tab to sent URL. I am using following code:
opened = ShellExecuteA(0, "Open", URL, Chr(32), vbNormalFocus, 1)
The problem is that this always opens a new tab after opening first tab. Instead I would like it to refresh that first tab opened by my function.
I was wondering if it can be done by getting browser's tab ID and then sending new URL to that tab if it is already openend so no new tab gets open with this call.
Any help would be appreciated.

Related

Not allowed to load local resource when opening chrome:// UI page from a chrome extension

I have a MV2 Chrome extension that on the popup page I added a "Shortcut" link so that user can access chrome://extensions/shortcuts by clicking it.
However, after upgrading to MV3, the link doesn't work.
Should I simply remove this feature?
You can resolve this issue by opening the page programmatically.
add some suitable selector to the link (popup html):
Configure Commands
add an event listener to open the shortcuts page (in popup script):
// get the DOM node
const link = document.getElementById("commands-link");
// add click event handler that opens the shortcuts page
link.addEventListener('click', () => chrome.tabs.create({
url: "chrome://extensions/configureCommands"
}));

How To Open a new Tab by passing some argument into URL

If somebody click on link that should have some parameters in url to open the link in new tab.
for example : www.youtube.com/c/devtechsolutions
will just navigate to this link.
What if I would like to open this link in new tab, just by modifying the url with someparameters.
Only url has to be modified.

Google Chrome Extension default in a new tab

so I am trying to make a google chrome extension and I want it to open when you open a new tab. Kind of like muz.li. Basically, when you press ctrl+t to open a new tab instead of showing google, it shows my extension.
Thanks!
Simple add the code below to open the extension when a new tab is opened, you don't need a background js or html file. It is in the manifest.json file:
"chrome_url_overrides": {
"newtab": "page.html"
},
I suggest to use the chrome.tabs.onCreated event to detect when someone opens up a new tab.
https://developer.chrome.com/extensions/tabs#event-onCreated

gulp refresh active tab after code change in chrome extension

I'm developing a chrome extension and I want to automatically refresh the active tab after a code change
I got gulp-open to work so I don't need to navigate to chrome://extensions anymore and manually click "reload"
now only the active tab refresh remains
I've tried gulp-livereload but couldn't get it to work for developing a chrome extension
any ideas how to approach this?
Could you post the code of your chrome extension? Without much info, I hope this is helpful. You can inject the code below to refresh the page after the chrome extension is reloaded:
chrome.tabs.query({
active: true, // Select active tabs
lastFocusedWindow: true // In the current window
}, function(tabs) {
// Since there can only be one active tab in one active window,
// the array has only one element
var tab = tabs[0];
// Javascript to reload the page
var code = 'window.location.reload();';
// Execute the code for the current tab
chrome.tabs.executeScript(tab.id, {code: code});
});

In an XAgent inside XPages how to redirect to a new Window?

I have this XAgent with seems to work fine but it opens it in the CURRENT browser. How would I open it in a new window?
This code is running in After RenderedResponse of an XPage.
Thanks
// Track Downloads
// Setup XAgent stuff
var exCon = facesContext.getExternalContext();
var writer = facesContext.getResponseWriter();
var response = exCon.getResponse();
var fileLink = param.get("link");
// Insert Logging Code here
facesContext.getExternalContext().redirect(fileLink);
writer.endDocument()
Looks like you are trying to track when somebody clicks on the download link.
Without tracking the link would have been pointing directly at the file causing the browser to initiate the download and the user would stay on the current page. With the XAgent tracking in place the user is going to a different page in the application to do the tracking and initiate the download.
You could add a target of '_blank' to the initial link that is calling the XAgent. This will cause a new window/tab to open in the users browser but it will close once the download initiates.
Using this method of tracking the downloads will, however, remove the ability for the user of the site to be able to right click on your download link and do a 'save as'.
For a download link you could also consider to just stream the file using the OutputStream (there only can be one: Writer or Stream!) to directly serve the bytes of the file to download. You need to set the MIME type in the header. If it is not a file type the browser can handle, the download dialog will appear anyway. Opening a new window is actually considered bad style these days. If a user wants a new Window there is Ctrl+Click and Shift+Click -> a decision you shouldn't make for them (which opens the can of worms of browser illiterate users).

Resources