Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 665
  • Last Modified:

SSL certificate in javascript

Hi

I am making an AJAX call in javascript to a https request. AT first i do not get any data nor does chrome ask/shows warning to install the certificate. If i hit the url https://... once in chrome and says proceed, there after the call to the https request in javascript works fine. How do i impose that message to come using javascript.
0
fbharat
Asked:
fbharat
  • 6
  • 5
  • 4
2 Solutions
 
leakim971PluritechnicianCommented:
did you try an hidden iframe?

<iframe style="position:absolute;height:1px;width:1px;top:-200px" src="https://..."></iframe>
0
 
fbharatAuthor Commented:
I am making an ajax call in javascript to an https:// resource.

thanks
bharat
0
 
leakim971PluritechnicianCommented:
I understood you want to throw the warning so I propose to you to do that inserting an iframe pointing to this https site
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
fbharatAuthor Commented:
I am not pointing to an https site. I am making an ajax call in javascript to a https resource. I get the JSON data , parse it and display in a div. Please see the code in the sample file
This does not work till i get the https url in browser and say proceed.
samplecode.txt
0
 
leakim971PluritechnicianCommented:
did you tried my suggestion?
0
 
RobOwner (Aidellio)Commented:
It's this a certificate generated by you or from a certificate entity?
0
 
fbharatAuthor Commented:
leakim971

can you please tell me how to implement your solution/suggestion for an ajax call. Did you had a look at the sample code i had send you

thanks
bharat
0
 
leakim971PluritechnicianCommented:
can you please tell me how to implement your solution/suggestion for an ajax call

You still not follow me :
Just place the iframe in the body tag to throw the warning box.
Using the iframe I hope you get the warning just like you get it when you open the page in your browser when you said : If i hit the url https://... once in chrome and says proceed
0
 
fbharatAuthor Commented:
But i cannot give the src attribute in iframe. I am retrieving JSON data by making AJAX call to https://. If i give src="https://" in iframe it will not get me the results. I am getting data from https request , formattting it and displaying in div.

Thats what i said can you give me the exact code

thanks
bharat
0
 
leakim971PluritechnicianCommented:
To provide you the exact code I need the exact url?
Or at least one using this domain, protocol and ssl
0
 
fbharatAuthor Commented:
0
 
RobOwner (Aidellio)Commented:
You Wouldn't get this message if you bought a valid certificate. Your certificate isn't recognised as being issued by a valid authority.
If you're not going to use an authority for purchasing your certificate then I you embed the iframe as has been suggested: make the iframe invisible for all that it matters, it's not important to see the data but rather that it makes the first call to the secure site and will prompt the user with the "security warning". When your Ajax runs it will work, assuming the user has allowed it
0
 
RobOwner (Aidellio)Commented:
So yes, put an iframe tag in your site with that url and make the css for the iframe 0
0
 
leakim971PluritechnicianCommented:
ok, the iframe trick don't work :(

the only thing to do is to add the certificate to your store or ask your provider to buy a certificate for the domain api.alphamaven.com

I understand YOUR site use https so you need to use SSL too
You can use a proxy on your OWN server to download the data for you so you're still using SSL

a simple one with php to put on YOUR server :

<?php
   // my_simple_proxy.php
   header('Content-type: application/json');
   echo file_get_contents("http://api.alphamaven.com/markets/interface/cashtag_selector?uid=825060248");
?>

Open in new window


so instead ajaxcalling :
https://api.alphamaven.com/markets/interface/cashtag_selector?uid=825060248
you ajaxcall :
my_simple_proxy.php

example :
$.getJSON("my_simple_proxy.php", function(data) { alert("ok");});

Open in new window

0
 
RobOwner (Aidellio)Commented:
Something's changed as your certificate is now valid! :) Works now i gather?

http://jsbin.com/EDARAvO/1/edit
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now