Solved

SSL certificate in javascript

Posted on 2013-11-13
17
544 Views
Last Modified: 2013-12-10
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
Comment
Question by:fbharat
  • 6
  • 5
  • 4
17 Comments
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
did you try an hidden iframe?

<iframe style="position:absolute;height:1px;width:1px;top:-200px" src="https://..."></iframe>
0
 

Author Comment

by:fbharat
Comment Utility
I am making an ajax call in javascript to an https:// resource.

thanks
bharat
0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
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
 

Author Comment

by:fbharat
Comment Utility
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
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
did you tried my suggestion?
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
It's this a certificate generated by you or from a certificate entity?
0
 

Author Comment

by:fbharat
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 82

Expert Comment

by:leakim971
Comment Utility
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
 

Author Comment

by:fbharat
Comment Utility
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
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
To provide you the exact code I need the exact url?
Or at least one using this domain, protocol and ssl
0
 

Author Comment

by:fbharat
Comment Utility
0
 
LVL 42

Accepted Solution

by:
Rob Jurd, EE MVE earned 250 total points
Comment Utility
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
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
So yes, put an iframe tag in your site with that url and make the css for the iframe 0
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 250 total points
Comment Utility
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
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
Something's changed as your certificate is now valid! :) Works now i gather?

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Bootstrap Datable Spinner 3 28
jQuery animation faster 1 16
Create a new template 9 20
jqplot Pie Chart 2 11
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now