Re-direct page to fb - javascript

Hello I am designing a landing page for my company.. We have ads on FB. we have button on fb when click on that button our landing page opens.
We have 2 option on page one with yes button which will open form and no button should close browser and re direct to fb page.. plz help how can i re-direct it to fb.
<button class="btn-yes">Yes</button>
This is my button which should be re-directed to fb.. plz help if possible with javascript, jquery.
thanks

You can use this jQuery code for your button.
$('.btn-yes').click(function() {
window.location.href = 'your fb link';
return false;
});
Add link to assign window.location.href.

You can use tag
<button class="btn-yes">Yes</button>
If you want to open it in new page
<a target="_blank" href="{your fb link}"><button class="btn-yes">Yes</button></a>

Related

How can I replace Current page with another page then open current page in another tab

Hello my Wonderful Developers, I need help on this
Let say my website is https://nkiri.pw/ and I want to click on a button or Link, I want my current page to be replace by this page https://itinerarycarter.com/qm37kgvszd?key=7f255a06003c7158485ad05f1e9672f3 and my present page should open another page automatically. How can I achieve this successfully ?
I was able to solve it by doing this:
<a role="button" id='mike' href="<?php echo "https://".$_SERVER['SERVER_NAME']."/" ?>" target="_blank" class="btn btn-primary">Primary</a>
<script>let linkElement = document.getElementById("mike"); linkElement.addEventListener("click", openNew);function openNew() {window.open("https://itinerarycarter.com/h9xdx19n?key=2053deb616c8b3ac8566b44a8ec7c092", "_self");}</script>
You are using a hyperlink. So you have a href="" in your html tag. You can also set the target (where the page should be opened) to _blank. This means, that the page will be opened in another tab. So if you write it like this:
href="https://nkiri.pw/" target="_blank"
It will open your current page in another tab. Then you can open the new page with js.
let linkElement = Document.getElementById("yourIdOfTheLinkElement");
linkElement.addEventListener(function() {
window.open("https://itinerarycarter.com/qm37kgvszd?key=7f255a06003c7158485ad05f1e9672f3", "_self");
});

How to make a Onclick Full Page Script not work on certain Function in PHP

I was given a onclick Fullpage Popup Ad code
<script type="text/javascript" src="//dolohen.com/apu.php?zoneid=2458038"></script>
It works on the whole page and when someone clicks on any part, it opens up a popup.
Now, I don't Want it to work on the Button, cause when someone clicks it, instead of opening the youtube URL, he goes to dolohen link and has to re-click the button to go to youtube URL!
My problem is I don't want this to work on this function:
function buttonOnClick()
{
window.open('https://www.youtube.com/channel/".$channelID."?sub_confirmation=1', '_blank');
setTimeout(aTagChange, 3000);
}
<button onclick="buttonOnClick();" onmouseover="mouseOver();" onmouseout="mouseOut();">Subscribe <i id="ytb" class="fa fa-youtube-square ytb"></i></button>

Can I submit a form in popup page to parent page, so parent page moves to other page without a new tab?

Can a Genius help me out here?
I'm working on Spring MVC Web Project with jsp.
There is a parent page that shows list of subject,
and a popup page shows up when user clicks a subject to check its password.
popup page transfers the inserted password by a form to parent page and close itself, so parent page moves to other page that shows its content.
It works fine in Chrome, but not in Internet Explore.
In IE, popup disappears and another page comes up with its content.
Does any genius know how I prevent the third page, and just have first parent page moves to content page?
Here is my code.
Hope someone help me here....
//the form in popup page
<form action="readDetail.do" name="insertedPasswordForm" id="insertPasswordForm" role="form" method="post" target="parentPage">
<input type="password" id="typedPassword" name="typedPassword"/>
<input type="hidden" name="privateId" value="${privateId}"/>
</form>
<button onclick="insertPassword()" style="margin-left:200px;">확인</button>
//submit the form by this button with javascript
//javascript
function insertPassword(){
opener.name = "parentPage";
document.insertedPasswordForm.target = "parentPage";
document.insertedPasswordForm.submit();
window.close();
}
I just changed the way to transfer the values.
I used Modal, so there was no need to use pop up.

Trying to redirect to full-site homepage onclick

I am working on a drupal website that has a mobile site and a desktop site. When in the mobile site, there is a "Full Site" button that should redirect the user back to the homepage of the desktop site. Since I need to set a cookie when that button is clicked, the "href" is left blank and the onclick goes to a function. However, when setting the "location.replace" in the function to the base url, I still get redirected to the existing page. Any thoughts as to how I can fix this would be greatly appreciated. Thanks,
ex:
current page = mysite.com/news-mobile
desired page redirect = mysite.com
actual page redirect = mypage.com/news-mobile
NOTE: This is a staging site so there is no "www"
html:
<div class="one_third">
<a class="buttonWrapper buttonBlue" href="" onclick=goToMobile()>Full Site</a>
</div>
javascript:
function goToMobile(){
var date = new Date();
date.setTime(date.getTime()+(60*1000));
var expires = "; expires="+date.toGMTString();
document.cookie = "ismobile = false" + expires;
document.location.replace('http://mypage.com');
}
EDIT:
I updated the html for the button to open in a new tab. This causes the original tab to refresh with the homepage, but the new tab still loads the desktop-version of that specific mobile-page. (i.e. window 1 opens desktop-home and window 2 opens desktop-mobil_email :doesn't exist). Any thoughts would be much appreciated.
New html:
<div class="one_third">
<a class="buttonWrapper buttonBlue" target="_blank" href="#" onclick=goToMobile()>Full Site</a>
</div>
I seemed to have solved this issue by changing the href tag to say href='#'

facebook connect redirect after invite friends

can I have a question about how to redirect the page after user invite their friends?
i have a code like this: (in javascript)
function inviteFriends(){
if(isBusy) return false;
isBusy = true;
$(".musicPlayer").addClass("invisible");
var fbsc = '<fb:request-form
action="apps.facebook.com/yourapp?pageid=thanks"
target="_self"
method="post"
nvite="true"
type="Contest"
content="Come and Join this contest!"> <fb:multi-friend-selector
target="_self"
showborder="false"
max="30"
import_external_friends="false"
email_invite="false"
cols="5"
actiontext="Invite your friends!" /></fb:request-form>';
var uiSize = FB.UIServer.Methods["fbml.dialog"].size;
FB.UIServer.Methods["fbml.dialog"].size = {width:625};
FB.ui({
method:'fbml.dialog',
display: 'dialog',
fbml: (fbsc),
width: '625px'
},function(response) {
$(".musicPlayer").removeClass("invisible");
window.location = "?pageid=thanks";
isBusy = false;
});
}
that script will call fbml window with facebook's invite friends dialog inside facebook dialog window.
what i want is:
when you close the window (press x at top right corner) it'll redirect to: ?pageid=thanks (this is works with the script above)
when user press the skip button on invite friends dialog it'll redirect to: ?pageid=thanks (this is not working - It'll redirect to ?pageid=thanks but inside the fbml window)
when user have done inviting their friends, it'll also redirect to: ?pageid=thanks (this is also not working - it'll redirect to ?pageid=thanks but in new window -.-!)
am I miss something on my script above, or I'm using the wrong way?
I'd like to achieve this for at least in IE and Firefox
is anyone have done with this before? I really need your suggestion,
EDIT:
if i put:
<fb:request-form target="_top" blah...> <fb:multi-friend-selector target="_self" blah...>
The skip button is working :) but still, after you're done inviting your friends it'll redirect to a new window
If I Put:
<fb:request-form target="_top" blah...> <fb:multi-friend-selector target="_parent" blah...>
This is work if you invite your friends, but not if you press the skip button -.-!
I reckon this is because of facebook open-up another dialog window when you click invite your friends (to preview before you click send)
so the structure level was different between skip button and send button (i hope you got what I'm write)
Thank you in advance
AnD
This is The answer :)
var fbsc = '<fb:request-form action="url here" target="_top" method="post" invite="true" type="Contest" content="blah...">
<fb:multi-friend-selector target="_top" showborder="false" max="30" import_external_friends="false" email_invite="false" cols="5" actiontext="Join NOW to WIN!" /></fb:request-form>';
Note: target="_top"
Try changing target="_self" to target="_parent" i'm not sure that is exactly what you need but the target is the relevant parameter here.

Categories