Google Identity Toolkit HTTPS issue - php

Home URL is http
Login URL is https
I have found that if I change the login URL although it says you are submit unsecure data the functions work. However when in https the functions do nothing and I cannot debug it to see what's going on.
window.google.identitytoolkit.notifyFederatedSuccess({ "email": "email#domain.com", "registered": true });
does nothing. The page loads and the user as far as the site goes it logged in but the modal window is still open the the site needs to be refreshed to show that the user that they have logged in.
All window Google commands do nothing. Any idea why?
Page Code:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/googleapis/0.0.4/googleapis.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/jsapi"></script>
<script type="text/javascript">
google.load("identitytoolkit", "1.0", {packages: ["notify"]});
</script>
<script type="text/javascript">
window.google.identitytoolkit.notifyFederatedSuccess({ "email": "email#domain.com", "registered": true });
</script>

It was a huge mess using google identity toolkit to have one domain log you onto another. IE company site logging you onto product site, but it is well worth it. It involved building 2 sessioning engines.

Related

php Ajax calls fails on one server

I copied a script that works on one server to another but it doesn't work on that server. To troubleshoot it I created a test file with just this code
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script>
ShowThePopout();
function ShowThePopout() {
console.log('show box');
$.post( "sidebox_ajax_test.php", { show_cart: true })
.done(function( data ) {
console.log('good result');
});
}
</script>
The sidebox_ajax_test.php file just has this
<?php
echo 'done';
I uploaded the two files to both servers. When the test page is visited, on the first server the console shows
show box
XHRPOSThttp:.../sidebox_ajax_test.php
good result
On the second server it shows
show box
No errors are thrown, that I can see. Both accounts on the servers are using php 7.4. I saw many posts about a similar problem that said CORS needs to be enabled and it is on both servers. Any ideas on how to fix this or what to try?
Problem solved. I tried using Chrome instead of FF and its console reported a problem loading jquery due to the link not being secure. Changed that and it worked.

Is it possible to make Iframe alternate?

My problem:
I can display content of a php file including(image background) using iframe. When I go to include my php file using
include("modules/form.php");
or
file_get_contents("modules/form.php");
it displays content, but background image becomes invisible. It is a big site. So, is there any alternate of iframe for this purpose? I do not want to use iframe because my ranking in google is becoming down.
You can't archive this using php , till far i know. PHP is a server side script it does not know anything from the client side. You can use jquery , first you will have to create a div and in it set the content of the page.Use the code below
<head>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js?ver=1.4'></script>
<script type='text/javascript'>
$(document).ready(function (){
$('#divId').load(full url to modules/form.php); // Paste the full url here
});
</script>
</head>
<body>
<div id="divId"></div>
</body>
</html>
Hope this helps you

mobile-site to main-site and main-site to mobile-site

I done main-site and seperate mobile-site.
Main-site is Wordpress
Mobile-site is HTML pages
and I put following script for mobile auto redirect.
<script type="text/javascript">
<!--
if (screen.width <= 769) {
document.location = "http://mobile.mysite.com/";
}
//-->
</script>
But now I need Full Site link to main-site in mobile-site. By the above script, it's redirecting to same mobile-site.
I tried with cookies. I dont know, why that not working properly.
Any-one help me. Thanks.
To redirect a mobile visitor you will need to determine if their browser is a web browser on a mobile device or not. You can determine which browser the visitor is using
If you are running a Content Management System (such as WordPress or Joomla), there may be plugins already available that help with handling mobile visitors.
Because mobile phones typically have a small screen width, you can redirect visitors to your mobile site if they have a screen width of less than or equal to 800 pixels. Place Javascript window.location code in the head section of your main website code. That way when your site is visited, the javascript will see the browser width and redirect to the appropriate site.
You can use a .htaccess redirect to transfer visitors based upon the MIME types the browser supports. For example, if the user's browser accepts mime types that include WML (Wireless Markup Language), then most likely it is a mobile device. The code below should be placed in your .htaccess file.
Note:
If you're using WordPress, try the Jetpack plugin. That comes with a free mobile version that you can enable. Anybody on a phone will see the mobile version automatically.
Main site to Mobile ,
<script type="text/javascript">
<!--
if (screen.width <= 769) {
document.location = "http://mobile.mainsite.com/";
}
//-->
</script>
Mobile to Main site ,
<script type="text/javascript">
<!--
if (screen.width > 769) {
document.location = "http://mainsite.com/";
}
//-->
</script>

Javascript Conflict in Wordpress

I'm trying to load an Aweber form via Javascript inside of a right sidebar widget. The form loads, although it appears differently than the way I designed it in Aweber. I'm 90% sure that it's a Javascript conflict because I loaded the Aweber form in the section with wp_enque_script, and the form looked correct (but I don't want the form to actually appear in the head section itself. The website can be found here: http://www.richmindonline.com/yourunlimitedself.
Obviously, the Aweber script is a direct call for action to grab the web form, so I cannot load it in the or it shows up at the top of my page. So is there a way to load my form in the correct place on the page while still using wp_enque_script to resolve my conflict?
Here's the code for the Aweber form (formatted wrong to fool the text editor). This code is currently found in a "text widget" in the right sidebar:
<script type="text/javascript" src="http://forms.aweber.com/form/74/1378551674.js">
</script>
The actual head section with relevant code is shown below. I don't have any idea as to what I should do here.
<?php wp_enqueue_script('jquery'); ?>
<?php wp_head(); ?>
Also, here is the relevant section of code that is currently un-altered for what I need.
<script src="<?php bloginfo('template_directory'); ?>/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_directory'); ?>/js/jquery.jcarousel.pack.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_directory'); ?>/js/jquery.easing.1.3.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_directory'); ?>/js/jquery.colorbox-min.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_directory'); ?>/js/functions.js" type="text/javascript"></script>
It'd be difficult to say where it conflicts without seeing errors and line numbers, etc.
This isn't an exact answer to your question, but a potential workaround with the information you provided. Aweber should give you the option to copy and paste the HTML of the form into your widget instead of the javscript code.
The advantage to this is you can edit the HTML to look exactly like you want. The disadvantage is that you would have to go to your website everytime you wanted to update the form as opposed to being able to update it in Aweber.

$(document).ready(function() isn't called

I've set document.ready in the middle of a page.
It was working fine on local server, on an online production beta server, but failed on the final server.
Any suggestions?
thx
Code:
$(document).ready(function() {
And yes. JQuery is loading and it's working propely
UPDATE: These days I've found the same issue and for futher reference the script tag that includes the jQuery must be propely closed. If not the $(document).ready() is never called.
Wrong:
<script type='text/javascript' src='js/jquery-1.6.2.min.js'/>
Also wrong:
<script type='text/javascript' src='js/jquery-1.6.2.min.js'>
Right:
<script type='text/javascript' src='js/jquery-1.6.2.min.js'></script>
Nowadays using hmtl5 <!DOCTYPE html>
Get Firebug and check:
is jQuery loading or is it missing. And is it loaded before the document.ready ?
is the script throwing any JavaScript-errors?
The most likely problem is the production server doesn't have a copy of jquery. Switching to having google provide jquery for you is a good practice.

Categories