Href with no value triggering reload on second visit to page - html

We have following link on our page:
Link
It has a click event bind to it which just toggles a class and returns false. When I am opening the page first time in browser, the click event works fine. But after reloading the page or opening it second time (in other tab or same tab, not in other window), the click of this link is reloading the page.
Adding href="javascript:void(0)" fixes the problem but why is this behaving like this on empty href?

Related

History.replaceState not working properly

I need to append tab name in the browser url on tab click.
I have used History.replaceState('','','newpath');
Example:
History.replaceState('','','localhost:8000/mypage.com/home');
Now suppose I have open the page using home tab. After that when ever I'm changing the tab, the tab name is changing for sometime in the url and after that its changing back to home tab.

Link to named frame as new window?

Back in the day, I could make a link with a target like this:
<a href="https://example.com/something" target="frameName" />
If a frame named frameName didn't exist on the page, the link would open in a new window/tab. That still works today. Now, add a second link:
<a href="https://example.com/somethingElse" target="frameName" />
If I click the first link, it opens in a new tab/window. If I then click the second link, I would expect it to open in that same tab/window that was opened for the first link. However, this isn't happening. Instead, the second link opens up in its own new tab/window.
Has this behavior changed? How can I get the old behavior back?

Google Tag Manager Link Click Event Listener Triggering on Page Load

I am having an issue that all of my Link Click Event Listeners are being triggered every time the page is loaded rather than when a user click the links.
Here is the setup for the listener:
This is the code of the link that I am trying to track. There are a number of these generated in a Wordpress query loop:
<a class="bookButton" target="_blank" href="http://testlink.com"><span id="3BDCNH">Book Now</span></a>
I moved the ID on to a span wrapping the text rather than on the link trying to see if that would change the issue. No difference between having it on the <a> tag or the <span> tag. Both still fire every time the page is loaded rather than when the user clicks.
The gtm.linkClick listener should be configured in a tag of its own to load on every page so that it listens to every and all clicks to any links. Your event should then be configured to fire when the event is gtm.linkCLick. This resource is helpful: http://www.simoahava.com/analytics/auto-event-tracking-google-tag-manager/.

browser back button causes an iframe to be navigated

I have a web-page and withing that page I am using an iFrame. this iFrame contains two buttons previous & next. On next button click I change the source of iFrame to lets say page2.html and on previous button click i change the source back to page1.html. Issue is when i click the browser back and forward buttons it causes the iFrame to navigate (depicting the functionality of those above buttons). How can I avoid this, that is on browser back button click previous page should be loaded (of browser's rather iframe's).
Thanks
I got the solution to the problem. I have to replace the url of the frame by window.location.replace(newurl).
in this case it doesn't add into browser history.

How to stay in current tab(tabview) on Page reload

How can I stay in the current Tab when using tabview when the page is reloaded
Add information about current/opened tag to url.
www.example.pl#contact-tab
after reload check which tab was open and open it again