Force navigator to Open Link in New Tab by URL - html

i have a request if possible,
i have an interface which containts a table :
name of application url
XXXXXX www.xxx.com
Problem is when I click in the url I lose my information on my current page.
my question is there is a code language by Internet explorer FF chrome... provide this action
open in tab this url to put in the url like the method version and the other
like this about:version ==> open in new tab : this url to put in the url navigator
and we get a new tab
thank you for help .
i try open in a new tab by tools provided by IE , but if possible provide a solution like a code entered in url to open a new tab

If I get you, you want your link to open the page in another tab.
You may use the target attribute of the link like this :
<a href="somepage.html" target=newtab>text</a>
If you want something you can type in the URL field of the browser, that is a bookmarklet, you may use this :
javascript: window.open('http://www.dystroy.org');
In most browsers, ctrl-click a link do the same thing.
EDIT :
If what you can modify is only the href attribute of the link, you can make this href be like this :
<a href="javascript:window.open('http://www.dystroy.org');" target=_blank>text</a>

If its a hyperlink just add a "target" to the hyperlink with its value as "_blank". Working example:
<a id="termsLink" href="www.someLink.com" target=_blank>
Terms and Conditions</a>

The java script solution works great in case of shortcodes which offer you an href (or url) option but no target parameter. Here is an example with a popular callout shortcode:
[callout title='Your big Title' text='your small text...' button_text='CLICK ME' button link="**javascript:window.open**('http://www.dystroy.org');"]
Without the javascript, the linked page would open onto the current one.

You don't need any code to open a link in a new tab or window. HTML already has that functionality built in.
Use an tag to show your url and use the target attribute to tell it to open in a new window.
Example:
www.xxx.com
Learn more about a tag and target attribute here

Related

Opening a link in new tab via context menu not working when using Router.go

I have a resources tag in the navbar.
On clicking it, user is navigated to that page (different URL). I did it using two different ways. Firstly, I used click event and used Router.go to navigate to that page.
HTML :
[li class="classic-menu-dropdown" id="resourcesNavBar"]
[a href]Resources[/a]
[/li]
JS:
'click #resourcesNavBar': function(event, template) {
Router.go('resources', {
resource_id: "all"
});
}
Then I used pathFor in the href tag to route to that page.
HTML
li class="classic-menu-dropdown" id="resourcesNavBar"
a href="{{pathFor 'resources' resource_id = 'all'}}">Resources[/a]
/li
Both worked fine, but in the first method, on right-click, 'open link in new tab' doesn't show up whereas it works completely fine in the second method (open link in new tab).
Please enlighten as why does it happen.
Apologies if language isn't very clear.
Can you show us your HTLM to be sure? I guess this is because in the first method your link element doesn't have an href attribut, or is set to . So your browser thinks it is going nowhere.

how to rename the html title from grails g:link with target _blank

I am working with grails. I have a link in a gsp page which is opening a new tab by the target _blank. In that tab I am generating a pdf report using jasper plugin. Now my question is that is there any option to give a name of the new opened tab. In my case the title of the html page is giving my function name from controller. Can anybody please help me on this please ?!!!
Here is my link as follows >>>
<g:link target="_blank" action="printDoReport" params="[slsDoMstMid: doForIssueInstance.MID]">Chalan from DO</g:link>

How can I open multiple links using a single anchor tag

So here's a simple but interesting question, how can I open multiple links using single <a> element?
Using this only opens the first href
Click Here
You can certainly try this
Demo
Click Here
I searched for that but unfortunately all methods I found don’t work.
I have one way to that with JS (but one linkwill open in the current tab):
HTML Code:
<a id="myId">go</a>
JS Code:
myId.onclick = function(){
open('https://www.example1.com');
location.href = ('https://www.example2.com');
}
So here it will open example1.com in another tab.
Then in the current tab, will open example2.com
Note: The order of JS Lines is required otherwise it will not work.

How to open a link new tab with print command?

I have a hyperlink with contains third party website link. I want to open this link in new tab with print command. How can i do this?
Suppose:
Print
Note: I know how to open a link in new TAB/Window. I want to know how to open with PRINT DIALOG.
You could try something like this:
​​​​​​​​​​​​​​​​​print pdf
This method works well for me.
<a href="/url/" onclick="window.open(this.href).print(); return false">
There is no way for a website to cause a browser to load a third party website and display the print dialog for it automatically.
<img src="print.png" style="cursor:hand" onclick="window.frames['pact'].print();"><iframe name="pact" src="pact.pdf" width="0" height="0" frameborder="0"></iframe>
This absolutely worked for me. I'm coding a site in Angular 6.
Print
Here's my source (enter link description here) but watch out for double quotes in the originak source.
:)
This is depend on your browsers, you can enable the tab for new link, If you are using Firefox you can enable the tab using Firefox -> Options -> options -> open a new windows in a new tab instead option

How do I get link to show HTML source?

I'd like my web page to have a "Show Source" link that will show the source of my HTML.
I'm also wondering if there's something I could append to the URL of my page that'll just show the source as opposed to rendering the page. Like this...
http://www.example.com/mypage.html#show_source
If you are okay with a link that opens source, you could use the following javascript:
if you are using FF:
window.location = "view-source:" + window.location.href;
and with IE:
var popup=window.open();
popup.document.open('text/plain').write(document.documentElement.outerHTML)
If all you need is code between the body tags - then you could do the following:
document.body.innerHTML
Can you provide a bit more information on the application?
"View Source Button" could be a solution, but if you need a direct link you need to change the Content-Type Header of your file to "plain/text".
If your page could be, for example, a PHP script, it would be:
<?php if($_GET["viewsource"]=="yes") header("Content-Type: plain/text"); ?>
and you can open link by appending ?viewsource=yes to your URL.
Remember, it works only "server side".