Detecting And Closing Frames Using Javascript
Jul 16, 2010
I'm working on an ASP.NET web application. There's a bill page which has two links to different pdfs of the same bill. When you click on one of the links it takes you to a ViewPDF.aspx page that shows the pdf. There's also an option to view both in a split screen so that you can compare them. When you click on this link it takes you to BillSplit.aspx which has a frameset and two frames that both point to ViewPDF.aspx. This all works perfectly.
The problem is that if an error occurs while pulling up the pdf. The application has an error page that has a few links back into the application. If you use one of these you can go back into the app and continue but now inside the frame. The URL still says BillSplit.aspx but the application is completely unaware of this since frames are HTML elements not asp.net controls.
What I would like to do at this point is detect that you've returned to the application and close the frame you aren't using. Essentially I'd like to redirect you away from BillSplit.aspx and to the page you're actually requesting. I'm pretty sure this would need to be done in Javascript either on the BillSplit page or on the pages that you go to later. So I guess what I'm asking is, is there a way to ensure that the BillSplit.aspx page and it's two frames point only at ViewPDF.aspx?
View 1 Replies
Similar Messages:
Jan 24, 2011
My LogIn action originally looked like this:
return new RedirectResult(nameValueCollection["ReturnUrl"]);
But, I would like to know whether the client has JavaScript enabled before the home page loads, so I changed it to this:
return View(new LogInViewModel { ReturnUrl = nameValueCollection["ReturnUrl"] });
And send the following view instead of the instant-redirect:
@model Obr.Web.Models.LogInViewModel
@{
Layout = null;
string noJSReturnUrl = Model.ReturnUrl + (Model.ReturnUrl.Contains("?") ? "&" : "?") + "noJS=true";
}
<!doctype html>
<html>
<head>
<title>Loggin in...</title>
<meta http-equiv="REFRESH" content="1;url=@noJSReturnUrl">
<script type="text/javascript">
window.location = "@Model.ReturnUrl";
</script>
</head>
<body>
<noscript>
Loggin in...<br />
<a href="@noJSReturnUrl">Click here if you are not redirected promptly.</a>
</noscript>
</body>
</html>
The idea is that if the user does not have JavaScript enabled, they see a brief loading message, and the home page loads after a second. If JavaScript is enabled, the page reloads instantly. In the future I could even post to the server the dimensions of the viewport and such. Does this look like it would work? If the window.location command takes longer than a second to run, will it be interrupted by the meta refresh, or does it block that refresh? I am hoping the latter, so I don't need to increase the delay for those non-js people.
I figure my new way adds a little extra weight to the payload of the redirect, but it's not an extra round-trip or anything, is it? The redirect happens anyway, does it not? Update: I neglected to mention a very important point. I do not actually have control over the login screen itself, only the page it posts to. This code is part of a product that relies on an external authentication mechanism.
View 2 Replies
Jul 20, 2010
I have created an AJAX style file download (using an iframe) and all works well... however, I need to detect when the iframe has received a response... see below:
Javascript:
function download() {
var ifrm = $('#iframedownload')[0];
ifrm.src = '/downloadfile.aspx?fileid=whatever';
ifrm.onreadystatechange = function () { // Checking
if (this.readyState == 'complete')
alert("I would really like this piece to work!");
};
}
C# for downloadfile.aspx:
Response.AddHeader("content-disposition", "attachment; filename="" + zipFileName + """);
Response.AddHeader("Content-Length", respBytes.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(respBytes);
Response.End();
View 1 Replies
Mar 24, 2010
Basically I have a Search Text Box with a LinkButton Control on which the click event is fired. now what i want is when the user type keywords and press enter the Click event got fired. So No Javascript Only ASP.NET With VB.NET v2.0
View 2 Replies
Sep 20, 2010
In my project there is a button search which seems to be the default button to trigger when enter key has been pressed. How can i detect a keydown event with jquery for a login button? Its an asp.net project.
View 1 Replies
Oct 29, 2010
I want to check if a mobile browser has javascript enabled before displaying a page to the user. The code I've found from my research is:
System.Web.HttpBrowserCapabilities browser = Request.Browser;
Response.Write(browser.EcmaScriptVersion.ToString());
So to ensure that javascript is enabled on a browser, you need to check wheather the returned valued is either equal to or bigger than 1. This works on normal browsers, but when I test it on my phone the returned value is always 0.0, no matter if my javascript is enabled or disabled. Is there a way to check if javascript is enabled on a mobile browser or will the browser handle the incapability on it's own?
View 3 Replies
Nov 2, 2010
The source tags inside my video element need to be self closing so the iPad doesn't start whinging.
I type in <source src="myVideo.m4v" />
TinyMCE keeps changing it to <source src="myVideo.m4v" ></source> though.
How can I tell it to stop?
View 1 Replies
Jul 20, 2010
I am using asp.net 2.0 with c#.
i want a pop up to be displayed when user tries to close the browser and if user click on "no" [i.e. he don't want browser to be closed] then it prevent browser to get closed.
View 3 Replies
Feb 12, 2011
First I am new to the asp.net world and am trying to figure out a weird issue that I am having. I have a page that has a form and on submit I launch another aspx file that exists in the same directory. The problem is the aspx file is shown and the file closes immediately! However, the weird part is if I make any modifications to the aspx file and save it and then run my application it works fine only the first time? Any subsequent submit actions launch the aspx page but then the aspx file immediately closes. But after I make some modifications to the aspx file..(simple ones) it launches correctly the first time. We are targeting .net version 4.0 and using IIS7. I am thinking that the asp worker process is doing something weird like checking for timestamps and closing it?!
View 1 Replies
Sep 22, 2010
I have a linkbutton 'Forgot Password?' in my login page. On click of the link button a modal popup will open . In that user has to give his username.
If the username doesnot exists i want to show an alert 'Usename doesnot ' exists.
Since the checking for the existenance of the username is on click of the button submit which is inside the modal popup, i can show the alert using the code
Page.ClientScript.RegisterStartupScript(...) . But I want something different
I want to call the javascript function after the maodal popup extender is closed
View 6 Replies
May 13, 2010
I have one control as below . I am using popup control extender which shows 4 images for colors. I want to close the popupexnternder once I click a color.Once I added $find('mpePopup').hide(); in javascript but its causing postback somehow .
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyColorPicker.ascx.cs"
Inherits="MyColorPicker" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:DropDownList ID="ddlColor" runat="server">
[Code]....
View 1 Replies
Oct 15, 2010
I am using the jQuery Dialog in ASP.NET. I have it working fine with the exception of when I click the OK button in the dialog and if an error occurred I want to show the error in the label. By the time the dialog closing event is fired it is too late. How do I still show the dialog if an error has occurred. I don't want to close the dialog when there is an error.
[code]....
View 1 Replies
Jul 23, 2010
I have an error when playing with a table saying:
"text is not allowed between starting and closing tags of an element table"
Table is like this....
<table id="Content2" class="createAccountTable" cellpadding="0" cellspacing="0" style="width: 240px;">
<tr>
<td colspan="2" align="left" valign="top" class="topicStyle">
<h3>Order Summary</h3>
</td>
</tr>
<tr align ="center">......
View 2 Replies
Mar 7, 2010
I'm working on developing a custom control to select items from a predefined list. This is accomplished via 2 ASP.NET ListBox controls, with a few buttons to trigger the movement of ListItems from one ListBox to the other (lets call these ListBoxes lstSelected and lstDeselected).
This is easy enough to do in ASP.NET or JavaScript independently: I have both working. However, if modifications are made via JavaScript, ASP.NET retains no knowledge of this. Is there any way to register the creation of of options in a select tag without AJAX?
View 2 Replies
Mar 12, 2010
I would like to convert my Frames-based web application to non-frames.Challenges:I have a frame of exploding tree menus (total tree around 1,000 menu choices - up to 5 levels of average 7 choices for each item). From this menu, one gets to the first content page (all dynamically created data pages). The content page can link to other content pages and so one.As the user navigates around in the right side, how can I have the display retain the exploded structure of the menu without using Frames (in a way that the browser back button will continue to work).Does anyone have an example of an application where there are many content sections on the screen which retain their state as the page is refreshed, without using frames?
View 3 Replies
Mar 16, 2011
My website currently uses frames. My index.html homepage looks something like this:
[Code]....
Well, apparently frames are way outdated, "element frameset is not supported" in XHTML Transitional 1.0 and "newer constructs are recommended." So, what do I do instead?
View 2 Replies
Aug 20, 2010
I'm designing an enterprise web application interface based on an old system, and i planned to migrate the old frames layout to master page, but i noticed that if i use masterpages, the application users will be able to see the querystring or route path, and it could be a security issue. What is the best way to avoid this? Using frames? Masterpages with iframes as content? Masterpages with all PartialViews loaded by jquery?
View 1 Replies
Feb 23, 2011
I want to capture the frames of a video file through C#. I dont want to use the FrameGrabber or other built dll's. I amlooking it from plain dot net without using COM.
View 2 Replies
Jun 15, 2010
In my page, I have two Frames (frame1, frame2) with one button on each frame as button1 and button2.
All I m trying to find out how can I click button2 from button1 in Frame1?
View 6 Replies
Oct 14, 2010
Utilizing Visual Studio 2008 and creating Web Application Project. I am looking to use Master page system with Frames. I was wondering if this is possible at the current state?
View 3 Replies
Aug 13, 2010
I'm having an aspx page with 2 frames, one is the header and the the other one is content frame which i'm trying to load it dynamically. Everything is fine. Let me explain my scenario
On the header frame i'm having 5 link buttons and when a link button is clicked i'm passing a hardcoded Page URL to the frames containing page and then trying to load that page in the content frame.
Below is my code, Everything as far as i know are in right place, but i cannot see the page in content frame..
Header.aspx.cs
[Code]....
Then checking frameURL querystring in default.aspx page load:
[Code]....
when the querystring is null, the SiteSummary.aspx page is getting loaded in content frame without any issue, but when there is a querystring value the page is not being loaded.
Here is my Default.aspx page
[Code]....
View 5 Replies
Jun 12, 2014
How can I integrate my aspx page into my existing php/html frameset page? So far I've designed the aspx page, now I need to know what to put in my button_click event.
In javascript I use this to get one textbox's text:
var t1=window.parent.text1.getText();
and this to set another textbox's text:
window.parent.text2.setText("text");
How can I tie this in to my button_click event?
View 3 Replies
Sep 17, 2010
So I'd like to redirect mobile users to a different page. But instead of trying to detect any number of mobile browsers, I'd just like to see if the user is using IE, Firefox, Safari, Chrome, or Opera; all other users go to the mobile site. My biggest problem is detecting regular Safari from mobile Safari.
View 1 Replies
Dec 19, 2010
i'm programming an application where an action is done if i access with a version equal or higher than other and another action if i access with a lower version; but the problem is that the lines to indicate the versions doesn´t work. The code is the following:
[Code]....
As you can see, an action should be done if the version is the 9.0 or higher and other if it is lower, but these lines doesn't work and only works the detection of the web browsers (no the versions of them, action that doesn't works).
View 2 Replies
Feb 23, 2011
I'm developing an extra section to a web app that's written in asp.net, but in php - it's mostly done (the two parts don't really communicate with each other outside of a database - the integration is mostly just cosmetic.)
The only issue I have is detecting from the php part when the .net session has expired so that it logs the user out and redirects to the login page.
I believe the asp.net application is compiled, but either way I'm not allowed to alter it so I was thinking maybe the best thing to do would be to make a very small/simple aspx page that outputs true or false which I could call using curl from php (and passing the browser's cookies along.)
Would this even be possible? I'm not sure how session security works on asp.net eg whether one .net application can read another's session variables, but if it's anything like php then it'll be possible.
mypage.php --curl--> checksession.aspx --|
| |
<----------- true / false <---------------
So mypage issues a GET (with cookies from browser) to checksession using curl, checksession simply returns a true or false (or something like that) and mypage redirects to the site's login page if that's false.
The authentication for the php side is already sorted out and is separate to this issue.
So really, what I need to know is can I have just a simple .aspx file that does this check, and if so where would I go to to find out how to program such a simple page?
View 3 Replies