Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SSL certificate in javascript

Posted on 2013-11-13
17
Medium Priority
?
648 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 4
17 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39644641
did you try an hidden iframe?

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

Author Comment

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

thanks
bharat
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39644925
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.

 

Author Comment

by:fbharat
ID: 39645333
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
ID: 39645347
did you tried my suggestion?
0
 
LVL 43

Expert Comment

by:Rob
ID: 39646131
It's this a certificate generated by you or from a certificate entity?
0
 

Author Comment

by:fbharat
ID: 39646789
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
 
LVL 82

Expert Comment

by:leakim971
ID: 39646799
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
ID: 39646845
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
ID: 39646887
To provide you the exact code I need the exact url?
Or at least one using this domain, protocol and ssl
0
 
LVL 43

Accepted Solution

by:
Rob earned 1000 total points
ID: 39646910
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 43

Expert Comment

by:Rob
ID: 39646918
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 1000 total points
ID: 39646967
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 43

Expert Comment

by:Rob
ID: 39647061
Something's changed as your certificate is now valid! :) Works now i gather?

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

Featured Post

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

715 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