I have an iframe of a website let name it foo.com what happen is that if the visitors click on the iframe on my website what happen now is that it will right away open a new window
The iframe is a video embed....
So I just want to find out would it be possible if I want to have an option like a popup window alert to tell the visitors by clicking this it will open a new page and if they click confirm will open new window direct to foo.com home page but if click on cancel then it will just stay in the same page [my page]
Just want to know if this is possible.
I not sure if the following will help.
Try:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function gosomewhere(){
var yes = confirm("Would you like to go to this webpage?");
location.replace("http://www.foo.com");
}
//-->
</SCRIPT>
</head>
<body>
Click Me
</body>
</html>
Let me know if it is ok
Related
I have two web pages written in VisualBasic.Net:
Upload.aspx
Default.aspx
There is a link in the Default page that opens Upload page in a different window.
In the Upload window I upload a file, and I want to display the name of this file in a textbox, which in turn is in a gridview on the Default page.
I think I want an asyncronous process that won't cause the Default page to refresh, but I don't know how to do this.
I created a very simple example for you. Here is the code of the first page (your Default.aspx let's say):
<html>
<head>
<script>
function ow() {
window.open('w2.html');
}
function update(updatestr) {
document.getElementById('update').innerHTML = updatestr;
}
</script>
</head>
<body>
open window
<div id="update"></div>
</body>
</html>
This page contains a link, which opens a new window (this will be your Upload.aspx page). It also contains a simple function called update, which puts a parameter value as a div html content.
This is code of a second page (your Upload.aspx like):
<html>
<head>
<script>
function update() {
window.opener.update(document.getElementById('txt').value);
}
</script>
</head>
<body>
<input type="text" id="txt" />
<input type="button" value="Update" onclick="update()"/>
</body>
</html>
This page contains a textbox and a button. After a button click, the content of the textbox will appear in a div on the first page. You can do something similar in your case.
I've put a working demo for you.
I'm using a servlet to show images on page. The links looks like
http://webappname.com/getImage?p=imagename.jpg
But the resulting image in the browser tab shows
getImage (100x200)
I would like to output there more useful information like string, so how can I do it?
As the response is an image, it cannot contain additional information (such as the page title) as an HTML response could. One possible workaround to this would be to return a simple HMTL page with your image in it.
You could trigger then trigger the regular download (the existing behaviour) with an additional URL parameter. So for example:
http://webappname.com/getImage?p=imagename.jpg
Would return this HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" src="img-dl-style.css">
<script type="application/javascript">
// JavaScript to trigger image download when #dlButton is clicked
</script>
<title>Full Image Name</title>
</head>
<body>
<div class="container">
<h1>Full Image Name</h1>
<img src="http://webappname.com/getImage?p=imagename.jpg&dl=1>
<button id="dlButton" type="button">Download this image</button>
</div>
</body>
</html>
Any direct access to this URL:
http://webappname.com/getImage?p=imagename.jpg&dl=1
Would return the image directly, complete with the default browser title.
To see this in action, take a look at Dropbox's shared file viewer. A link such as:
https://www.dropbox.com/s/qmocfrco2t0d28o/Fluffbeast.docx
Returns a full webpage with a preview of the shared file and a download button. Clicking the button triggers the download with this URL:
https://www.dropbox.com/s/qmocfrco2t0d28o/Fluffbeast.docx?dl=1
This is the script for a webpage with a GO TO MOBILE SITE button. When the button is clicked I want it to go to the mobile site.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function goMobile() {
window.open("mobile.dudamobile.com/site/syedasadiq");
}
</script>
</head>
<body>
<input type="submit" value="Go to mobile site" onclick="goMobile()" />
</body>
</html>
I'm certain that I've done everything correctly, but when I click the button on my browser it prodoces an error message saying: "Cannot find ...:/Users/AbdurRasheed/Desktop/mobile.dudamobil... Make sure path or Internet address is correct."
I think that the computer is registering my mobile URL as a file and not a website address, but I do not know for sure. Either way, how do I fix this problem?
Thanks in advance.
Use window.location.href = "http://mobile.dudamobile.com/site/syedasadiq".
I have an asp.net page with a grid. On RowDateBound event
mybutton.Attributes.Add("onclick", "javascript:window.showModalDialog('some.aspx?ID="
+ mybutton.CommandArgument +
"','window.self','dialogWidth:800px; dialogHeight:800px;center:yes; status:yes; scroll:no; help:no');");
on some.aspx page I have dropdowns and asp.net button that does a postback.On postback the some.aspx page opens again in a new window (Browser).
How to prevent this?
I appreciate your support.
I've had this problem before with ASP.NET and a ModalDialog. What you need to do is set the <base target="_self"> tag in the head of the page. It sounds too simple to be correct but it's what fixed it for me.
This frustrated me quite a bit.
If you need any help with this, just ask.
<html>
<head>
<title>My Page</title>
<base target="_self">
</head>
<body>
<!-- Your content -->
</body>
</html>
You can place a return false; behind the link / button to stop the post back from happening.
I have one page from which i have to redirect to a page which is in some other application or can say in other domain.I want waiting screen till the page is loaded.I want to do it by jquery.Can any one help me-
blockUI would be an option
eg.
<html>
<head>
<meta http-equiv="refresh" content="3; URL=http://www.mydestination.com/">
<!-- script include for jQuery and blockUI -->
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
$.blockUI({
message: 'redirecting'
});
});
</script>
</body>
</html>
but if you want to keep the overlay on the redirected page while it is loaded, this would be only possible if you use eg. an iframe. but with that, you would have other problems eg. height, width of iframe