in a last stint to change from EI to Edge, I'm trying to do some focusing that doesn't work like I want it to.
The situation is something like this. Edge is open with several tabs for different pages. One of these pages is an intranet system where the pages contains a link which opens a popup.
In this popup the user has a button where they can create some docx files on a server. To do this, the button calls a new page (subpage1) through javascript (window.open) and the new page again calls another page (subpage2), which finally creates the document.
The later (subpage2) will close (windows.close) it's window on completion.
It all works like it should, with the little annoyance, that the "mother" windows in Edge will switch to the tab to the far right, instead of just staying on the user choosen tab.
Can I control which tab keeps or regains focus when a tab are closed in Edge and if so how?
Related
I am creating a website and on the website, I need about 10-20 more tabs on the user device,
I know how to do this with javascript but the user can disable javascript on the browser which basically stops the entire point of the website, is there any way to do it without javascript (maybe sending a header to Chrome or something that opens a website in a tab)?
There is no way to do that without JavaScript to open multiple tabs at once.
You can make a link open a new tab with the target attribute when clicked by the user, but that is limited to one new tab for one user interaction.
maybe sending a header to Chrome or something that opens a website in a tab
Even if that would be possible with some kind of trick, it would likely be fixed in an update in the browsers, because this will this would be definitely be abused by dubious websites.
Well, the pure HTML way to do that is through the target attribute of any hyperlinked element (A, FRAME, FORM), which shall contain the name of the window that should receive the content of the hyperjump.
Example:
<!--These two hyperlinks redirect the URLs to the same tab-->
local clients
inernational clients
<!--This hyperlink redirect the URL to its own tab-->
providers
Anyway, I warn you not to abuse of this form of forced navigation, because it can chase your user out of your website: The user should be left as free as possible to chose to open or not new tabs/windows. And 10-20 tabs seems to me an overwhelming amount of tabs.
I have a website and while testing I noticed that if I use tab navigation selection goes throughout my inputs and elements and after the last one focus goes to browser address bar and in some cases (browsers) other browser related elements.
Is there a way to avoid focusing browser elements?
I suppose there should be a way to do this, because I am using Visual Studio Team Services and in case of open popup tab navigation, the navigation doesn't go outside the popup.
I also noticed that if I open a popup dialog in my website even the elements outside the popup (the page from which the popup is called and is staying behind) are being focused.
I hope someone could help deal with this
So I recently implemented a chrome extension to grab images in an active tab and extract them to a popup for downloading. I would like to give users the option to view the popup window (including the extracted images) in a new Chrome tab.
However, since the popup is created dynamically by appending children to the body of my popup.html, I'm not sure how to pass the HTML for my popup to the new chrome tab.
I tried using chrome.tabs.create({url: chrome.extension.getURL('popup.html#window')});
as found at Open chrome extension in a new tab
but this doesn't seem to be working. Any suggestions?
I'm also developing a Chrome Extension that involves saving down a user's browser data.
Since each time an Extension opens a page (such as popup.html in your case) it opens a new instance of it, the pages and their relevant activity will be independent from each other.
In short you will have to implement some storage. The silver lining is it's pretty simple. Everything you need from manifest to example functions is here:
https://developer.chrome.com/extensions/storage
In your case what I'd imagine you'd want to do is this:
When you pass image urls to your popup page you also save them as items in an array in storage.
Then your pop up page can load in the array as the list to set downloading (or preview depending on use case).
Then either users can delete items from the array, or they are deleted programatically once downloaded.
I can't really be more specific without knowing exactly what your extension is trying to do or how it works, but hopefully that's enough to set you in the right direction.
This question already has answers here:
Chrome New Tab Page extension steal focus from the address bar
(4 answers)
Closed 4 months ago.
I'm making a Chrome extension that involves putting a text input on the new tab page, and immediately giving focus to that input text when the new tab page loads. After being unable to get focus using traditional methods (e.g. focus()), I stumbled upon this question:
Chrome 27: New Tab Page extension can't steal focus from Omnibox
which states that Chrome has now made it so that you can't steal omnibox focus on a new tab page. Given that Chrome is fine with giving focus to any site that isn't the new tab page, I've been trying to come up with workarounds, but nothing is really satisfactory.
I've tried:
Having the new tab page redirect immediately to locally-stored HTML file, but this still doesn't give focus because the page never had focus while redirecting.
Overriding ctrl+t and cmd+t in a content script to open up a new tab with the contents of a locally-stored HTML file. This works fine, except it seems you can't override cmd+t, so Mac users would be forced to use ctrl+t. Also, some sites (e.g. OneNote online editor) take over ctrl+t, so it doesn't work on every page.
Hosting the page remotely and having the new tab page redirect to it (far too slow).
Suggesting users press tab twice to focus on the input text when opening a new tab :)
Does anyone have any other suggestions as to how you might work around this restriction? It's pretty critical to my extension.
Thanks!
Hello from my question you linked!
On your New Tab Page, include the following JavaScript:
chrome.tabs.create({ url: chrome.extension.getURL("foo.html") });
window.close();
This will create a "normal" tab, and then close the New Tab Page. You can then focus() your input box on the normal tab.
This is what I've done for my Fauxbar extension. It adds a slight delay when clicking Chrome's New Tab button (in terms of how long it takes for your input box to become focused), but I reckon it's better than having to press Tab.
You could also implement chrome.commands to create keyboard shortcuts that users can modify themselves under chrome://extensions > Keyboard shortcuts.
I have a page that has a table whose rows are links to other pages.
When there is a click on a row (link), I set location to that URL like this:
window.location=mytable.rows[temp_no].getElementsByTagName("a")[0];
And in one of those link, a video player starts to play a file in the link and I want it to keep playing when I go back to the previous page so that I can listen to the music when browsing other links.
I go to the previous page with:
window.location.href="..";
This destroys everything i.e. video player naturally. I can't popup a new window or open video player in a new window since this application works on devices which have single browser window.
Any solutions ?
Of course it does. Changing the location causes the full page to be unloaded and the new one to be loaded.
If you do not want this behaviour you'll have to use AJAX to reload only parts of your site.
Opening the video in a popup window would be another solutionbut new windows are usually annoying, so provide the user e.g. with a "open video in new window" link.
Edit: In this case - assuming the TV browsers have sane JavaScript engines - use AJAX.
Another "solution" would be adding an onbeforeunload event to request confirmation from the user before he navigates away from the page.
Without being able to use a new window or AJAX it is impossible unless you use frames and just load another page in a different frame.
Use window.open on your videos in a different window so the parent window can navigate wherever.
Keep in mind that you'll have to disable any pop-up blocker.
** UPDATE **
If you need everything in the same window, consider using some iframe to view other pages. The advantage of iframes is that they have their own CSS styles, Javascript sandbox so any page viewed within an iframe does not (generally) affect it's parent container. Of course, there are ways to communicate between an iframe and it's parent and vice versa. But this is out of the question scope.