Meteor: Fire Event on Browser Back Button - meteor

I am using Meteor.JS and want to fire an event (Animating the Closing of a modal) when the user hits the Browser's Back button and want to avoid in some cases, that the back default behaviour happens (so only close modal, do not change page, at second click change page)

Consider using history.pushState to change the URL bar when your modal appears, so that going Back does the right thing. A library like backbone.js or a Meteor package like iron:router can help with this.

Related

Xamarin forms - force show back button

I have a tabbed page, with 4 navigation pages in it.
I want the back button to show on the 'home' page of each of the navigation pages, and then I want to override the event so if its clicked on the home page it will go back to the previous tab (i'll keep track of the tabs they have been on myself).
I'm trying to show the back button on the root of each navigation page with this:
NavigationPage.SetHasBackButton(this, true);
But the back button doesn't seem to show up. How do I force the back button appear?
I think the best way is to not go for a back button. Remove it and add your custom button with the functionality you are looking for. The reason for this is because you're doing totally something different where the NavigationPage is designed for.

Nothing happens when pressing button in cucumber, capybara test before adding sleep

I have a problem where I have a page with a kind of coupon that should change given several different button presses.
However, in one case, it seems that I am unable to click a specific button without adding a sleep between finding the element and pressing the button.
non working code:
element = page.find("[for='someButton']"])
element.click()
working code:
element = page.find("[for='someButton']"])
sleep 2
element.click()
I am wondering if there is anything I can do to remedy this issue without having to add a sleep, as I fear this makes my test more brittle as well as causing an unnecessary delay
PS.
No errors are being thrown and I did not write the web-application myself. I did however talk to the one who implemented this page and he said that there should not be anything special about this one button and that it should have it's event listener added as soon as the page loads
This could happen if the button is rendered in the DOM before the click event handler is bound. Capybara will be able to find the element as soon as it's in the DOM.
If this is the case, the tests are actually showing you that there is a (minor) bug. A real end user that clicked the button while the page is still loading would see the same result. A cleaner option would be to render the button via JavaScript and bind the click handler at the same time.
If changing the page isn't an option for you, there may still be hope. If there is something else on the page that is rendered by JavaScript in the same iteration of the event loop, you could add something to the test that looks for that before trying to click the button. For example, in the app I work on at my day job, we render an animated spinner GIF on the page when it loads, and then hide in in JavaScript when the page is fully loaded. Our Capybara tests wait for the spinner GIF to be hidden before interacting with the page.

Asp.net prevent modal popup to get displayed while clicking on browser back button

GoodEvening Everyone,
I am having one asp.net application which contains many links. some of the link displays modal popup Now if i move to link which nabvigates me and click on browser back button so modal popup gets display which i dont want. i need the previous page should get displayed instead of modal popup if i click on browser back button
for example
i clicked on link1 - navigated to page2
i clicked on link2 - displayed modal popup
i click on link3 - navigated to page3
Now if i click on browser back button so modal popup get displays instead of which i want the page2(previous page before the modal popup ) should get displayed.
So please let me know is this possible and how its possible.
It will be appreciated if some one provide me code to do this...
Let me know in case of more information required
There are several reasons this might be happening.
It might be that you are setting some state flags that persist between pages that influence the modal popups visibility. If you need help with this we will need some more details and preferably code samples.
It might be a browser caching issue. When you hit the back button the browser might be fetching the page from it's cache (not the server) with the popup visible. To test this you could disable the browsers cache and run through your process. If this proves to be the reason you can disable browser caching for your site by adding some meta tags (you'll find the exact tags on Google easily)

Passing information between windows ASP.net

Here is the problem: I have a HTML page called test.html and an ASPX page called getitem.aspx.
Now what I want to do is, upon clicking a button on test.html, I want the getitem.aspx page to open in a new dialog and allow entry on a text box. After clicking the OK button on getitem.aspx, this dialog should close and the entry should be passed back to the html page.
The issue is that the getitem.aspx has several buttons that trigger postback - but I only want the item from the text box to be sent back to test.html upon clicking of the OK button and not any other buttons.
How could I implement this?
You should use javascript to do that
first you need to use window.open() method to open the popup
after you have closed the page you should use window.opener for accessing to the closed windows and use javascript method like (getElementById) to find the element on that window and read it's value and then use !!
Hope it helps

How Can I extend The session time when there are multiple forms

How to extend the session time. There are many form in my application like parent and child forms. So how can I make pop up to appear when session times out and the pop up should appear on the form where the user is currently in, when popup comes I have to disable all forms like(they should be transparent (i.e) user should NOT be able to edit them).
how can i extend the session when I click on the OK button. Please can anyone suggest me
You can have a javascript timer running on the page when it loads. When it gets close to the session time out you fire a modal popup with a button to extend the session.
Using a javascript library like JQuery or JQuery UI would make the modal popup real easy to show.
The extender button can be a fake postback that automatically extend the session.
Here are some helpful links:
http://forums.asp.net/t/1136242.aspx
http://forums.asp.net/t/1471076.aspx
http://forums.asp.net/p/1207721/3094847.aspx
Any postback / request to the server will extend your session window.

Resources