Stop page refreshing when clickig a target _blank link - html

I want to put a link to a external page, but when I click on the link, which is meant to open a new tab, the original tab gets refreshed too while opening the new tab, I want to stop the refreshing since it has a session open and refreshing it leads to the login form of my page, is there any solution to this?
<a style='text-decoration: none;' target="_blank" href="(link to
the external web page)" >Visit</a>
I've been searching and I just can't find a way to fix this, not sure if I missed something or if I'm not searching with the right words, is just a normal <a href='extlink'> link that leads to another web page

I were told that could be a javasccript attached to the link, and that was the issue, I was using a class that refreshes the tab onclick without realizing,thanks for the suggestion

Related

Anchor Tag href redirects to an untitled page

I want to use an <a/> tag which redirects to some page. But the problem is that when I click it, it doesn't open, and when I click on open in a new tab, it doesn't load properly. The url is correct but it won't load.
You can see that the url is properly loaded, but the page wont load.
But when I simply press enter in url, it loads somehow.
Here's how I gave the href.
<a href="{{HOST_BASE_URL}}art/search/category/paintings/">
It works if I manually add the value of {{HOSE_BASE_URL}} like this:
<a href="http://localhost:8000/art/search/category/paintings/">
How do I resolve this?
What do you see in console and server logs when visiting the URL from tag? The URL in the above code and the screenshots is different, please add more details if the issue is happening for every URL or only a select one.

Displaying LinkedIn content with `iframe`

I am making my website, and I want to put my LinkedIn profile in the Bio section. However, when I use iframe, I get that LinkedIn refused to connect. Is there a way to embed my LinkedIn profile in my website using HTML? Thanks!
<iframe src="https://www.linkedin.com/in/your-name"></iframe> yields:
LinkedIn allows you to create a badge, and put that badge in your portfolio/website. So, in order to make a LinkedIn badge, follow these steps:
From your LinkedIn profile, click on Contact Info which is next to the number of your connections.
Then click on the pen at the top right corner to edit the Contact Info.
The first thing you'll notice is your LinkedIn profile link. Click on it.
A new page will be opened, you'll see a column at the right of the page, and at its end, you'll find a box entitled with Public Profile badge and a Create a badge button at the bottom. Click on that button.
Copy the script tag and paste it at the bottom of your HTML sheet.
Scroll down, you'll find 4 designs for your badge. Select the proper one and copy its code from the bottom of it and paste it where you want the badge to be shared.
I know it's a long journey, but it's worth it.
NOTE: The link to your LinkedIn profile will always open in the current tab, even if you add to the a tag the attributes target="_blank" rel="noopener noreferrer". If you want the link to be opened in a new tab, put this line of code inside the head tag at the beginning of your HTML sheet <base target="_blank" />.
Another IMPORTANT Note: After putting the base tag inside your head tag, every single a tag inside that sheet will be opened in a new tab by default.
HAPPY CODING AND GOOD LUCK
Browsers these days prevent this from occurring by expecting iframes to only frame pages from the same site. It's to prevent clickjacking. and it's controlled via the X-Frame-Options header. You should see a similar error on dev tools, if you press F12 you should see this error
*Clickjacking, also known as a “UI redress attack”, is when an attacker uses multiple transparent or opaque layers to trick a user into clicking on a button or link on another page when they were intending to click on the top level page.*
Your hosting provider may have a policy in place to prevent this from occuring, or if that's you, you will be able to amend this default value on your server.
You can disable this via Chrome for your development.

How to make continuing of HTML new tab?

So, I started learning HTML few days ago, it's really easy and I understand those basics, but I didn't found the thing I currently need... So, I made a Link on my website, and when I press that link it will go to my site for example if I click "Start" it will go to "_blank" where the new things comes. So when I press that link to go there, how do I make the code that will load in that new tab, I still don't understand it. Hope you understand what I want, thank you for your help.
target="_blank" Opens the linked document in a new window or tab
target="_self" Opens the linked document in the same frame as it was clicked (this is default)
target="_parent" Opens the linked document in the parent frame
target="_top" Opens the linked document in the full body of the window
Source: https://www.w3schools.com/tags/att_a_target.asp
The tag defines a hyperlink
Consider this example,
Visit W3Schools.com!
The "target" attribute specifies where to open the linked document, it can take any of the values in (_blank, _parent, _self, _top, framename) when it's value is '_blank' then the hyperlink will open in the new Tab.
Then "href" attribute will consist of the actual hyperlink, that is a URL that will open in the new page.
As you want a hyperlink for your own website, you need to give a link that works & would be served by your web server (Fro Ex., Apache). You need to put the web pages in the websever var/www/ folder if your server is linux with Apache webserver. Similarly. If you give any other website link as href, then that web page will be loaded.

On-Click A-tag with Href, socket gets disconnected

I am working on a project using socket.io. I want to give user some links to download a file as
<a href="<path>" >Link Name</a>
When I click on link to download file, my socket gets disconnected.
When I use this
Link Name
it works fine. Any reason why this happens?
When you follow a link within the same window, the current page's environment gets completely torn down, including the entire JavaScript environment in which your code (and socket.io's code) is running. That's why it does this when you click a link to a new page within the current window, but not when you open a new window (target="_blank").
You'll want to look at the various single-page-application techniques, which mostly involve swapping content into the current page using ajax (and updating the hash so the URL is different) without loading an entirely new page into the window.
You can try to target downloads to a hidden iframe. This would prevent page reloading:
<iframe id="downloadIframe" name="downloadIframe" style="display:none;"></iframe>
Link Name
We specify id as well as name for iframe for cross-browser behavior.

Opening hyperlinks in one tab only.

So I'm new to Web Development, and I wanted to know if there was a way to have a hyperlink in HTML, to be opened in a new tab, once clicked on. From there, I would want to have another hyperlink open in that exact same new tab that was opened for the previous hyperlink. Basically I have two hyperlinks that open in the new same tab, versus having the hyperlinks opening in each of their own new tabs. Currently I've been programing this webpage in HTML. Also this is my own project, not school related!
compare your test
some text
some text
To make a link open in a new tab, include target="_blank" in the properties of the a tag:
<a target="_blank" href="xxx.html"> sometext</a>
See also https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a