What I am doing is sending a user a link to a page but I want to close that page once the user submits the form.
To do this I have to open a new window for the user
//this always opens a new tab not a new window
open in new window
after the user opens the link I don't want to close his/her browser (from where the user opened the link). All i am sending is the link in a e-mail.
This is not something you have any control over.
Given a target attribute indicating that a new browsing context should be opened, the choice between opening a new tab or a new window is a user preference and not under the control of the page author.
If you were using JavaScript, then you could specify the dimensions of the window using window.open() and a side effect of that would be to trigger a new window instead of a new tab. Since you are working in an email, that isn't an option. Email clients strip JavaScript from HTML formatted emails.
Related
I have an application that is a portal which links to other apps. The links open up those apps with a target='app-name' so that if they open it again and the window exists, it opens in the same window.
However, while in the app, we have a link to go back to the portal window but that window has no 'target=portal' tag...it opened up first - let's say via a bookmark. So when the link is clicked, we get a new portal tab/window...now we have two. The users want us to find the existing one.
So how do I 'name' the portal window so I can get back to it with a target='portal'?
You can try
window.name = 'portal';
According to MDN article about window.name,
Gets/sets the name of the window.
The name of the window is used primarily for setting targets for hyperlinks and forms.
Be aware it's DOM Level 0, not part of any standard.
I want to open a link in a new tab, equivalent to the: target=_blank"
But instead of opening a new tab/window, which in my case can result in the user (old people that are bad with tech) not knowing that a new window opened, I want to open a smaller window, on top of the current window/page. This is so that the user sees the new window easily.
Is there a nice way to do this?
This can either be in code behind, or client code, it doesn't matter for me
<script type="text/javascript">
// Add this on the page that will open up.
alert('New window opened!');
</script>
How about a simple alert?
For example HTML's href tag has a target attribute that can force the page to be opened in a new window. But conceptually is this a good idea? Should the content determine how the user should read it? Or should this be entirely up to the user (right click -> open in new window)?
I disagree. A link shouldn't be forced to open in a new window. If the user wants to open it in a new window then it is up to them.
Normally when we redirect to a link which is of the current site then it should/may open in the same window. But if the link redirects us to another sire then its better to open it in a new window so that the user will stick to our(current) site. There is no specific rule. It is mainly done as per client's requirement.
One drawback of in opening the link using right--> click is it makes the user do one extra click. In case your page has 5 links and the user wants to open them in new windows/tabs each time he/she has to do an extra click. This is just an example. It all depends what the user wants.....
the following is on a page, when i click it - I DO NOT want the page to refresh, but only the new window which this link opens - i want to refresh that newly opened page, not the main window.
clicking the link opens the new window correctly, but refreshes the main window also (where the link lies). that is undesirable and i want to know how to stop it from doing so.
clik to open new window
clik to open new window
pl advice.
as advised below, but not working: infact it is breaking the new window, new window appears as blank window!
clik to open new window
Here's the proper way to open a link in a new window. If javascript isn't available, the link will still work.
Click Me
mywin is a window name, not a variable.
You need to store the returned wobject from window.open() in a global variable:
onclick="window.mywin = window.open('URL','mywin');">
The problem with the main window reloading is likely the href="" line. This could be causing the browser to navigate to the same page where it is presently (and therefore refreshing). You should add return false; to the js, and likely also adopt a more standard link target like href="#" which will navigate to the top of the same page without a refresh (though this will still get cancelled by the false return).
friends, it is resolved by doing this:
clik to open new window
I am developing a chrome extension. I am able to pass a message from background page to popup extension when a context menu is clicked if i open the popup page with "Inspect pop-up" selection. Because it stays open in this way.
But if I click the context menu when the popup page is not opened, no message received by it.
Do you have any suggestions to open popup automatically, make it stay open or send message to it when even if it is not active.
There is no way to pragmatically open a popup window. Popup windows are only active when the popup is open which is why you cant send messages to it when it is closed.
You could either queue messages in the background page and have them retrieved the next time the popup window is opened. Or depending on the functionality you might look into using HTML5 desktop notifications instead.
Instead of sending stuff to the popup, the popup should request what it needs when it is opened.
Because the popup is just an HTML page, it doesn't exist until it has been opened.
Basically, like abraham mentioned, you would store any information in the background, using localStorage or chrome.storage. When the popup opens, it should then use the chrome.extension.getBackgroundPage() function to get a reference to the background, which can provide access to the stored information.
If you are using localStorage or chrome.storage, you may be able to access it directly, without using the background, as storage is shared across the whole extension.