My question is I want to open a advertisement but condition is .. when i click on data url
at that time data url opened also with another new window advertisement also open.
So how i write a code so open two page : one my content(data) page and another is
advertisement page..
Please give me a answer for my problem.
Run an onClick="function()" and a link.
<div onClick="openAd()"></div>
<script>
var function = openAd(){
window.open("ad");
}
</script>
Here I use window.open(), which does what it sounds like and opens a new window with the link.
Related
Here's what I'd like to do in Coldfusion:
On a webpage there is a "Download" href link and I want another browser tab to open when the user clicks this link. In the new tab, I am creating a PDF via CFDOCUMENT in Coldfusion. This in of itself works.
However, since the PDF has a delay before it loads in the tab, I want to display a popup to the user that the PDF may take a few moments to load.
So what I tried to do was this sequence:
User clicks "Download" ->
On the same page, I trapped the link with jquery and displayed a popup
window alerting the user there may be a delay ->
User clicks OK on the popup ->
Using javascript window.open, redirected to a new browser window for the PDF.
This was unsuccessful because using window.open in javascript is not trusted by browsers and the new tab doesn't show up because of popup blockers.
So then I thought I'd create a popup in the new browser tab instead before the PDF loads, but discovered I can't use javascript on a page with CFDOCUMENT.
Any ideas as to how to best accomplish this if anything can be done?
I think iframe might be your friend here. It allows you to display another document in the pdf page.
Using your example in the comment, I created two files: one to display the prompt message and one to display the PDF.
cfprompt.cfm
<body>
<div> this is a test </div>
</body>
<cfflush>
<iframe src="pdf.cfm" >
</iframe>
pdf.cfm
<cfdocument format="pdf">
<h1>Hello ColdFusion</h1>
<p>This is <strong>PDF</strong> example document.</p>
<p>Genereated at: <cfoutput>#TimeFormat(Now())# on #DateFormat(Now())#</cfoutput></p>
</cfdocument>
You're still going to have to play with the formatting/sizing of the iframe so that it displays correctly, but hopefully this allows you to display the PDF.
I have a website for which I have implemented livechat, when user clicks on livechat link it opens a new window that is fine. I want to do is when no operator is online then it should not open a new window when livechat link clicked instead it should redirect to the contact us page of the website in the same window in the currently opened tab, Is it possible?
I do not know how is it possible, what I have tried is this , it redirects to this page but opens in a new window.
window.location.replace('http://mywebsite.com/index.php?route=information/contact');
The problem is somewhere in the code around that. You need to call that code in the old window.
If you want to call it in the chat window, try:
window.opener.location.replace('http://mywebsite.com/index.php?route=information/contact');
window.close()
Use the href property instead:
window.location.href = 'http://mywebsite.com/index.php?route=information/contact';
You can use simple javascript code like this: window.location.href = "SOME URL"
it will do the same think. .
i have seen adcash.com site under pop up/new page which is opened by every browser in new tab without any issues.i tried searching everywhere but could not find how to open a website in new tab without affecting the current webpage.
if you have used adcash.com site under script you might have noticed that when you click on next or any link one complete webpage will open in new tab and your present page will not at all affected.
plz help.i want to open ndtv.com in new tab not in new window but when users click on next page link that page should open there itself but ndtv.com should open in new tab.it means it has to work as usual and open next page in parent page plus new page in new tab.
According to what you said in the comments I think you are searching for something like this:
Click
What this will do is: Whenever you click "Click" it will go to where-you-want-to-go.php, and in the mean time it will open up google.com in a new tab.
Do two actions with one link.
<a target="_blank" href="http://www.google.com" data-location="http://www.example.com">Google</a>
$("a").on("click", function () {
window.location.href = $(this).data("location");
});
I'll try and keep this short. I have a page with various section. One section has an iframe with a google map in it. On the infowindows i have a link which when clicked i would like it to open in a fancybox over the page(not in the iframe...i can do that). For example if i had a link saying "google", id like it to open http://www.google.co.uk/ over the whole page in a fancybox.
I have 2 different pages and 2 javascripts, 1 for the map(iframe) and another for the main page. The function is in the main page script.
Where i think im going wrong is a) the right call to open the page b) attaching a class to the javascript i.e class="fancybox".
My map info window has this link in it(map.js):
some content
In my main.js:
function openSomething() {
//this is where i think im going wrong
//ive tried window. and top. etc
var url = "http://www.google.co.uk/";
document.location.href = url
};
My call to the fancy box is in the main page.
Any help would be much appreciated.
No need to use JavaScript: set the desired link as the href attribute, and use the target attribute to define where it is opened.
target="_top" will open the new link in the entire page
target="_parent" will open it in the parent frame or page
target="_blank" will open it in a new window.
I have the following javascript bookmarklet which opens a new popup window with a facebook post page in side of it.
javascript:var d=document,f='http://www.facebook.com/share',l=d.location,e=encodeURIComponent,p='.php?src=bm&v=4&i=1261526047&u='+e(l.href)+'&t='+e(d.title);1;try{if (!/^(.*\.)?facebook\.[^.]*$/.test(l.host))throw(0);share_internal_bookmarklet(p)}catch(z) {a=function() {if (!window.open(f+'r'+p,'sharer','toolbar=0,status=0,resizable=1,width=626,height=436'))l.href=f+p};if (/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}}void(0)
I just add that code into the URL of a shortcut link in my browser and it opens the facebook post page and passes the URL and some info about the page I am on to it.
I need to do a much simpler task. I need to get the URL of the page I am on and either open a new tab or even just use the tab I am in and then open a link like this
http://mydomain.com/labs/iframe_header.php?url= PUT THE CURRENT PAGES URL RIGHT HERE
As you can see I just need to make a bookmarklet that will take the page I am on and pass it into my sites page. Can anyone help me, I don't know much javascript at all, would greatly appreciate any help.
javascript: location.href = 'http://mydomain.com/labs/iframe_header.php?url=' + escape(location.href);
This will open in a new window, which will use a new tab if your browser is set up that way:
javascript: window.open('http://mydomain.com/labs/iframe_header.php?url=' + escape(location.href));