How to focus on previous tab in all browsers using jQuery? - javascript

I'm stuck with an issue; on OpenTwoPages link button click, I'm redirecting to an example.aspx page and in the example.aspx Page_Load event I'm redirecting to example1.aspx page, when click on OpenTwoPages button two pages (example.aspx and example1.aspx) will open in different tabs, browsers will consider example1.aspx will be the current tab, but I need to make an example.aspx page will be the default page when clicking on the OpenTwoPages button.
how can I do this using Jquery or C#?
Thank you.

Related

JS Disable browser back button as soon as your page is ready

I am trying to disable the browser back button via JS code and have already seen lot of answers like
How can I stop the browser back button using JavaScript?
and
Trying to disable the browser's back button
But my problem is unique, The issue is that once my page is loaded and I don't click inside the document (Anywhere on the page) my browser back button still function the way it use to.
But If I click inside the document/page, all the above scripts and code works properly.
So the I want to ask that if there is any way I can make the document(page) active somehow so that if the user click directly on back button without clicking inside the page, They should not go back.

Button disables on click but remains disabled when returning to same page via back button

In our ASP.NET MVC application I have been assigned a task to disable button which links to another page (due to user clicking multiple times). The issue I am facing is the button remains disabled when the user comes back to the same page via browser back button.
Any help would be appreciated:
JSfiddle here:
https://jsfiddle.net/spdLnm2r/
I have purposley not add css classes as the issue is irrelevant to design.
Testet on Chrome Version 98.0.4758.82

Trigger click event hyperlink's generated after calculation in javascript

I have a web page available in two modes:- default and hosted in a WebBrowser control. My links in the page are setup after some calculations so cannot be static. If user clicks the generated link, that opens in a new page. When in webbrowser control, I want all links to be intercepted and the call handled in the webbrowser container.
I tried to generate a link using How do I create a link using javascript? but it seems that although the click event fires, the page being targeted doesn't opens.
Any way which I can trigger the opening of new page
Please look below code, It would be helpful for you to open new tab in WebBrowser control
window.open(url, '_blank').focus();
Hope it helps you

What is the difference between clicking the refresh button in the browser and selecting the link and pressing enter?

In my web application,I have made a pin popup which is supposed to popup and disable the rest of the screen after a timeout. When the page is refreshed(Ctrl+R) or clicking on the refresh button, the pin popup appears, but if the link is highlighted and enter key is pressed, the popup does not come.
How is the (click on link and press enter) different from a (Ctrl+R) or clicking on the refresh button?
Please Help
Thanks in advance.
Generally: clicking on a link (or tab to and enter/space) starts a new GET (get from scratch (like open a new browser and paste the url in the address)).
While refresh/ctrl-r resends the previous command - if this was a POST then you get another POST.
You can use ctrl-f5 for a new GET.
In addition: Any element on a page (specifically a link in this case) may have an event handler applied which can stop the default action.
So, if yout link has an event handler that contains e.preventDefault(); or return false; (eg <a href='...' onclick='return false;'>link</a>) then it would appear that nothing is happening.
Pressing enter/space on a focused link is the same as clicking it (runs the .click() event handler).
Clicking Refresh or Ctr+R reloads page by making a fresh server request. In this case, making a server request is done for sure which is not the case when you just click & enter the link in address bar. In 2nd scenario, it just reloads the page. It mayor may not go to server but reloads it from browser cache.

how can I prevent the user leaving the page when hitting the browser back button in Jquery Mobile?

Just wondering.
I have a page in Jquery Mobile which uses a popup that opens as a fullscreen page on smartphone displays:
Desktop/Tablet:
Smartphone:
Problem is, if the user views the page on smartphone, this looks like a real page. When the user hits the "back" button I provide, I'm just closing the popover. However, if the user hits the browser back button, he's leaving the page, because he never went a page down in the history.
Question:
Since I can't disable the browser back button, is there another way to create a browser history entry when the popover opens, so when the user presses the back button, I'm simply closing the popover and the browser history is back on the initial page vs. going "-1". If there are other workarounds to achieve this I'd also appreciate any suggestions.
Thanks!
Maybe what you can do is add the popover as a dialog page if the webpage is opened from a smartphone (you can use user-agent to check for this). You might want to check http://jquerymobile.com/test/docs/pages/page-dialogs.html That way it will be added to the browser history.
Try adding a live Vclick.
or
you could try disabling the class ui,
Example:
class="ui-disabled"

Categories

Resources