I have one requiremt like There is button which is named Start/Stop. When he clicks the button first time number of hours caluclated until he clicked second time on same button (i.e Stops).
E.g:- He clicks first time (time interval should be caluclated) and he clicks second time (stop) after 8 hours. So total time is 8 hours.
2) When he clicks first time (i.e Start ), appliation should not allowed to access of other pages. Once he clicks second time (i.e Stop) then it should allow the application.
Thanks,
Ravikiran
One of the way of making it work is to use the modal popup covering the entire page once the user clicked the start button and put the second button on the top of it to close . jqueryUI modal popup is one of the example. My solution does not stop user to type the path in the URL and try. In that case you can put the value in Session with the flag saying
if(Session["Started"] != null)
{
//redirect to same page where the timer is running
}
This is going to be almost impossible to stop the user from going to another page via the address bar.
Ignoring the address bar problem for a minute, you will need to have client-side logic to check for events happening in the browser (i.e. user closing a tab, hitting back button, etc.), which if you are only using server-side logic it will be too late to catch.
It really sounds like you need for this to be a WinForms/WPF/Silverlight application instead of a browser-based application, because of your need to restrict navigation.
Related
Is there a way to track the time from when the "Window Loaded" event happens until a button is clicked on the page?
I tried several different things, like setting up a timer that would only fire if "Click Text" is "Download" but that doesn't stop the timer trigger from firing every second. I could never stop the timer on an event or a button click.
Brian
I found this answer from Simo about how to do this:
https://productforums.google.com/d/msg/tag-manager/xJ0RGC2wecY/rxmrJRklAgAJ
When you create a Universal Analytics tag, you need to add in all the required fields. Now you don't have any fields populated in your Timing hit so GA can't build any hit out of it.
You need to fill at least Category, Variable and Value fields: https://developers.google.com/analytics/devguides/collection/analyticsjs/user-timings
But judging from the bit you wrote at the end of your latest response, I think you've kind of misunderstood how the timer trigger works.
The timer trigger STARTS a timer upon the page load (GTM's default timer) or any user interaction (my custom timer). You still need to specify a "stop" to the timer to calculate how long something took. Neither GTM's default timer or my timer trigger can help you in identifying how long something took. They can simply be used to measure IF something took X seconds, where X seconds is the interlap between "interval" and "limit".
If you want to know the number of milliseconds from when the page was first loaded in the browser to any interaction such as a click of a button, all you need is a Custom JS variable:
function() {
return window.performance && window.performance.timing ? (new Date().getTime())-window.performance.timing.domInteractive : undefined;
}
This variable would return the time delta in milliseconds between when the variable was invoked and when the current page first became available to the user. So if you want to create a Timing tag out of this, make the Timing tag fire on the click of the button, and then in the timing Value field add a reference to this variable. Thus you'll have a Timing tag that sends the duration it took for user to land on the page and then click the button.
Simo
First I want to make clear that my problem is not a technical question. I want to talk about usability.
In my company we have a function to check if a scale works properly. We have the button you see bellow (1) to start a function named scaleCheck(). During the scale check the weight of the scale is set to 0 and then a specified weight is put on the scale automatically and when the weight matches the number set in a config file the scale is OK. So when you click on the button, it gets the white border (2) and when the check is finished the button turns normal again (3).
This is the automatic process, but not every customer has a scale which can put automatically a weight on it. So in this case the customer has to go to the scale an put a weight on it by his own. In our application the customer can configure, if he wants the process to be manual or automatic and the button will adjust to this. So when the configuration is set on manual we have to interrupt our function an wait for the customer until he is ready. Because we don't know how many time he will need, he has to click on the button again to tell the application that the process can continue. Therefore we changed the button a bit when we are in manual mode. As you can see below the button (1) changes the image, when the customer clicks the first time on it (2), to show that the weight has to be put on the scale. When he clicks the second time the process proceeds (3).
So this is the current state. The automatic mode works how the customers imagine it to be, but in the manual mode many people have problems with it and need a lot of time the recognize that they have to click on the same button again they clicked before.
And here is my question, is there a better way to show the customers that this button should be clicked again. Are there some people who have experiences with a similar kind of functionality? Or is there a better way to do it? I'm open for every idea which comes in.
We ended up with the opinion that it is not a intuitive solution to click twice on the button. We solved it by showing the user a message after the first click on the button, and accepting that message is count as the second click. With usability in mind this i by far a better solution and the customers can handle this situation much better.
I am trying to figure out ways to authenticate a user and load the application (while showing a preloader) in Adobe Air [desktop application, and not web based flex app].
This is what I have been able to achieve so far:- A window asks for login details, once validated I make the login window invisible and open an instance of the application's main window. There are 2 problems with this:-
I have to open a new window (2 windows in total). It would rather look better if I was able to simply show the login form in one state and the main application view in another state. I tried that too, but the problem is that besides the view component, flash does execute all the actionscript and keeps the other state ready. There is some application view centric actionscript which starts throwing null reference errors etc. On top of that, the whole things takes a while to show up as both views are created, though only 1 of them is shown
I'd like to show a preloader once the user is authenticated, until the main application view is loaded
In a nutshell, this is what I am trying to do:-
Load the login window as fast as possible and stop there (actionscript in other parts of the application should not run)
Post authentication, load the main view of the application. Show a preloader until the loading is done
Load the main view in the same window (rather than opening a new window and making the login one invisible)
Need help and direction as to how this could be executed.
Thanks!
UPDATE 1
Ok, so now I've managed to consolidate the functionality in a single window. however, the transition between states is not a smooth one.
State 1 is the login screen. If the user enters the correct login credentials, State 2 of the view becomes active.
Now for State 2 to load (its a bunch of UI components and a grid with loads of data) it takes time. Until then, the application blanks out and then all of it is shown in a jerk. Can the transition be made much smoother? Just showing 'Loading...' would suffice. Because State 2 won't show up until all of it has been constructed and State 1 dies away as soon as I change the current state to State 2. Is there any way to monitor the progress and changing the state only when the next state has been loaded!
UPDATE 2
Ok, I got the transition animation to work between states. However, there still exists a problem with the transition switch. The problem is that the state I switch to after login has been verified has a lot of components and shows a lot of data.
Is there a way I can attach Listeners (if any), which I can fire when the state loading is complete and view has been generated! The current jerk like effect in the transition is because the state has changed but the view has not completed yet.
State Change to State 2 is not smooth as State 2 loads about 10000 rows of data from database. Is there a way I can change the state visibly for the user, after state 2 has been completely drawn out and has pulled in all data? creationComplete doesn't help much here.
In short, is there a way to start loading a state from an initial state and make it visible only when its complete loaded? i.e. can I fire an event from state 1 to load state 2, but to visibly transition to state 2 only when state 2 is completely loaded..
UPDATE 3
After a week of firefighting, posting a bounty and scavenging through the web I have still not been able to fix this! My application window becomes unresponsive for the time the UI is created and data is loaded. In Windows, it even shows 'Not Responding' at the window title bar for about 5 seconds. So its the UI getting stuck because the data is taking some time to be fetched and loaded - all of this happens in a single thread by default.
How do people who develop based on Adobe Air do this? I've mostly always seen a loading screen before the actual game is loaded - and when its loaded, its fully functional. There has to be a way!
The time consuming problem of loading 10000 rows in a grid can come in any web based language in any web application because web application needs to run in the environment of a web browser which has its own resource limitation.
So what I would suggest is that you don't load all 10000 records at loading the view. Instead load 1000 records first and then keep a link or button with label "Next" or "Show More" like and on that click bring the next bunch of 1000 records from the database. This way you can accomplish your task.
Thanks,
Jigar Oza
I have a page which contains an iframe. The iframe can take user's input (via button click or menu selection) and display content accordingly.
What I need is, when a user manipulates the iframe, the browser push each set of iframe parameters into history; and when the user click at back button, the iframe will reload its content using the saved parameters from the previous history entry. I have a piece of code doing the reloading as shown below.
The strange thing is, when I make multiple settings on the iframe (hence multiple state entries added to history), and then click at back, it'll work like this,
Say that I have state 4, 3, 2 in history and I'm now at state 5
the first click restore to state 4 (the "----state changed----" logging message is printed
the second click reloads the iframe with default content. The "----state changed----" is not printed; the reloading code is not called.
the third click restore to state 3
the fourth click is like the 2nd click
the 5th click restore to state 2
So after each click that successfully restore the state, it takes two clicks to trigger the popstate event (I tried statechanged event, too, with same result) and restore to another previous state.
Anyone know what's going on here? Thanks in advance.
History.Adapter.bind(window, "popstate",
function (event) {
console.log("----state changed------", History.getState());
console.log("----state data------",History.getState().data.state);
//code to do reload an iframe to its proper state
});
So I stumbled on this same issue. The situation we had was using history.pushState() to update the URL and then after that changing the src attribute of an <iframe>. By changing the src of the <iframe>, we are implicitly telling the browser to add to its history that the iframe had changed. Thus...
When we pressed back the first time, window.history's popstate is
triggered on the <iframe>'s src attribute and is reverted back to it's previous state.
Pressing back a second time triggers the popstate event for the state you originally pushed onto the stack
Our solution involved that when we decided to update the URL and push the state onto the stack, when we wanted to update the <iframe>, we used jQuery to replace the <iframe> list so...
$("#iFrameID").replaceWith(('<iframe id="iFrameID" src="' + location + '"></iframe>'
By doing this, we removed the side effect of the browser history getting polluted with our update to the <iframe> tag.
I had the same problem.Instead of navigating the user to the previous page on the website, the back button navigated the user to the previous page inside the iframe. This code below will help you to solve your problem:
iframe.contentWindow.location.replace(href)
Our users can currently select a number of funds from a page and go to another page to see the funds compared on a chart. I now have to present the user with an option to produce a print-friendly fact sheet page for each fund in the chart.
The requirement is that each page will open in a new window (or tab), and be minimised so as not to be 'too intrusive' when they're opened. Can somebody suggest how I could go about this? This also means that the user will have to go to each window or tab to print the page.
They also want the print dialog box open in each of the new windows so the user doesn't have to open it. Is this possible, for the print dialog to open at the page load? If so, can somebody suggest how - JavaScript?
I disagree that (up to) 10 new windows can ever be anything but intrusive! Ideally I could send these new pages directly to the print queue. Is this possible?
Otherwise, I could Generate a page dynamically for each fund, strip out the contents of the page body and add the content for that fund to a large single page print-friendly factsheet. Does anyone have experience in this kind of work? Any pointers?
several points
you cant control new tabs vs new windows, this is a browser setting.
if its tabs, you can only have one print dialog per browser instance (depends on browser, but generally speaking). It tends to be modal.
you can call window.print() on page load to trigger the print dialog automatically, but its not very user-friendly
Whats the problem with creating a print friendly css and simply having a print button on the page that calls window.print();