I am developing a custom application feedback tool. The idea is that when the user launches a particular application, I want a pop-up to appear, say a couple seconds after the user launches the application, that asks if they'd be willing to provide feedback. The pop-up will simply be a new IE window. So, something similar in functionality to:
Response.Write("<script>window.open('" + sUrl + "', 'mywindow','resizable= yes,scrollbars= yes');</script>");
We have numerous web apps (ASP.NET) in our company, and I think the quickest solution would be to drop an HttpModule into the application's solution. For an ideal example, see: http://www.foreseeresults.com/.
QUESTION: Is invoking a new internet browser pop-up possible with an HttpModule? Or is perhaps invoking JavaScript from an HttpModule possible on the client's browser?
You can achieve this by using ASP.NET HTTP Response Filters.
You implement your custom filter and then set it inside a custom HttpModule or inside a Global.asax file by handling the PostReleaseRequestState event.
Bellow is an article by Scott Mitchel on HTTP Response Filters.
https://web.archive.org/web/20211029043851/https://www.4guysfromrolla.com/articles/120308-1.aspx
This article contains two simple response filters, which should give you the right direction on how to implement your case. I suggest you to display a modal dialog using jQuery and display a message. When user confirms that dialog open a new web page in new window (this way you'll also get around popup blockers).
Hope this helps!
Regards,
Uros
Related
I have a checkout process that lets users add items to cart, and they are able to go through the first step of the checkout before logging in. Once it gets to the part where they have to log in, I'd like to use a popup div for this rather than redirecting them to a login page so it doesn't feel like they're leaving the checkout process.
I'm not sure what the best way to implement this is though. In a perfect world, there would be a way to integrate this idea with the existing asp.net forms authentication and it would popup the div over the page you're already on before redirecting to the protected page. I don't 'think' that's possible though so wondering how else could I do this?
There are a variety of ways to skin this cat. If you are a bit more old school, you can use the AJAX bits and modal popup control extender. If you are not using the AJAX bits for anything else, I would not go this direction.
A newer approach would be something like a JQuery popup: http://www.formget.com/jquery-popup-form/
As JQuery is integrated with ASP.NET now, this is a much more modern approach.
The key here is making the call outside of the page context, which means JavaScript (AJAX is essentially JavaScript (and XML - as the name implies)). You then can bring the user's context into play without sending to a login page and then bringing them back to the cart checkout page.
There are other JavaScript libraries that can be used for the same purpose. I would google login popup JQuery (or other library) and you will likely find a full implementation somewhere and save yourself time inventing it.
So, I've seen this approach on one site (I can't remember it, though) and it works like this:
First, there is a simple page with a simple login form. But when you click the login button of the form, if the validation of user and password is positive and the response from the server is positive as well, a new pop-up window appears (which contains the application written in javascript - ExtJS) and the current tab of the browser (which was the login form page) closes.
In my opinion, this is an excellent approach because the ExtJS is a single page application pattern, powerful enough to run full AJAX, without visible redirects. Plus, the pop-up scenario eliminates the browser page control buttons (back, forward, refresh) and the address bar is read-only.
Now, I'm trying to reproduce this by using the help of ASP.NET as server side scripting language, among ExtJS as the main application. So, the results would be as following:
Login page with a login form - HTML5 + CSS3
Application page (pop-up window) - purely ExtJS
A web service - ServiceStack
The web service exposes the method for login purpose, as well as the other methods, and it always returns JSON responses. A session variable must be set (if the login was successful) before opening the pop-up and closing the window.
And here comes the question:
How can I accomplish this scenario of opening a pop-up and closing the current window/tab if the login was successful? Any help, hints, references, advices, criticism is totally what I'm expecting.
Thank you!
you should be able to close the current window after open another one.
window.open('new window url'); window.close();
I tried this on my box, and it works well on chrome and safari
<input type="button" onClick="window.open('popop.html'); window.close();" value="open" />
Keep away from opening pop-ups if you really don't have to. All modern browsers are set up to prevent you from opening pop-up windows by default.
AFAIK the only 100% scenario to open a new window (with target attribute) is a hyperlink clicked by user.
window.open() and even document.getElementById("hiddenLink").click() are blocked by certain browsers.
Are there any real positives of doing so or is it only a false novelty of that site? The reasons you state are all well with one-window scenario.
Is it possible to update another persons page from another page? ie what i am trying to do is... when a user updates a treeview with some data, i would like to broadcast the changes to any other user who is online and automatically update their treeview with the changes.
Is there some sort of pattern that i can have a look at to do this?
thanks yal...
In realtime? You would want to use JS polling or COMET techniques.
Heres a solution using silverlight and WCF Duplex http://blog.developers.ba/post/2009/02/25/Silverlight-chat-application-using-WCF-full-duplex.aspx
This looks awlright too http://code.google.com/p/aspcomet/ Should work with a JS client (see http://www.cometd.com/)
I am building a Web Application using asp.net (C#). I come from windows forms development and find myself in a hard spot. Im making an application where the user should edit some simple information about himself, and thus i need to create a new dialog. How do I do that in asp.net? I have a button which event is handled serverside, and when i click lthis button i want to popup a dialog where i can show my custom web control (or any web control, lets make it generic from the start). How do I go about with doing so?
I got some part of the way by looking at the internet, that i need to make a section and set the z-index to 1000, but how do i make it visible (block)? Please help here as i am completely lost...
/H4mm3rHead
If you're not concerned about using a library, try Microsoft ASP.NET AJAX Control Toolkit, they have several controls that can create something you want (the ModalPopup control).
The AJAX Control Toolkit has a ConfirmButton extender which will do exactly what you are looking for.
I used to do the following:
1. my new pop up is just a new aspx page like any other page
2. add a button (or just a link) that fires a client side java script function
3. in the function I use window.open and put params to open my popup page with no toolbars or scrollbars and proper size to its content
check this for more info on #3
I am writing an ASP.NET 3.5 web app that displays a list of items. I want to be able to display a non-modal popup with details when the user selects an item. I want to be able to display several detail popups simultaneously. (i.e., the user can click an item to see its details, then click another item to get another popup.) Currently I call RegisterStartupScript during postback to write a "window.open(...)" script to the page when it re-renders. The problem, of course, is that this requires a full page postback and refresh.
It occured to me that this might be a perfect use for XMLHttpRequest or AJAX but I don't know how to do it (or whether it's even possible or smart to do this). Can someone show me the way?
I have the AJAX Extensions installed but I'd prefer not to use the AJAX Control Toolkit.
EDIT:
Some clarification: When the user selects an item a custom event is raised. On the server I handle this event and use some server-side logic to construct a URL which I then use with RegisterStartupScript to construct a "window.open(myUrl...)" script. But posting back the whole page to do this seems inefficient and I'd like to know if I can just make a call to a simple server-side function that constructs the url and sends it back without having to roundtrip the entire page.
Creating a popup has very little to do with AJAX, and a lot more to do with JavaScript. See the jQuery dialog library here. You can then use jQuery's AJAX API to do your server dirty work :)
jQuery Dialog UI
--
Bill Konrad
Devtacular - Web Development Tutorials
You can use DHTML Window widget.
It offers many way to display either modal or non modal window.
Also it supports AJAX.
You can use dhtmlwindow for open a new window, or
dhtmlmodal to open a new modal window.
Of course, you can edit it to match your requirement.
Sample:
var insWindow = dhtmlmodal.open("insbox", "iframe","UserMaster.aspx?" + queryStr, "User Master", "width=425px,height=500,center=1,resize=0,scrolling=1", "recal");
Do you really need to open a new window? Opening an absolutely positioned DIV or a new layer on top of the current page in the same window is all the rage these days.
Edit:
I don't think it would limit the number of popups, there is some neat stuff that can be done these days with libraries like jQuery + jQuery UI, you can simply create as many of these DIVs/layers as you need and make them movable, resizable, etc. Only thing that real popups have and these do not is that they do not appear on the tab panel/taskbar.
Yes, you will be limited to the size of the window in which is the main page opened, however, I don't personally see it as a problem since most people surf in a maximized browser window anyways.
Implementation of the oldschool typical popup window is undoubtedly much easier for you, but it also runs into problems with end user popup blockers. Just had that problem # my work, they needed to make a popup during the certificate authentication process for some reason and as soon as Yahoo released a new version their toolbar, it quit working).