function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
neao18neao18 

Issue with Http and Https access in visualforce pages.

Hi all,

 

I have a issue with Http and Https access in visualforce page. I am using jquery remotely hosted lib as: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>

 

and I have added the address in remote site setting too.

 

But when i change this to this: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>

 

Http to Https (also added this in remote site setting). The script stops working!!

 

Did any body faced the same problem??

bob_buzzardbob_buzzard

When you say the script stops working, does it fail to load or are there problems once it has loaded?

 

I've used this without problems in the past.

neao18neao18

The script is not loaded (fail to load)

I have checked it in session Setting and unchecked Use Http and now in I.E I get a warning to use http and when I click No its works.

But my question is why we cannot call a http address from our visualforce page.

 

Re: I got this from Inspect Elemt:

 

[blocked] The page at https://c.ap1.visual.force.com/apex/TwitterTweetsDemo?core.apexpages.devmode.url=1 ran insecure content from http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js

 

bob_buzzardbob_buzzard

I'd expect you to be able to use https in a visualforce page - I assume this is an internal page, as you are getting a warning when you use http.

 

Can you get at the loading error?  (For example, google chrome would tell you this if you opened the inspector and looked at the resources).

bob_buzzardbob_buzzard

This is the error when you use http - do you see an error when you use https?

neao18neao18

Nop I don't get any kind of error while using Https.

bob_buzzardbob_buzzard

You must be getting an error somewhere, or the resource would load.  It won't be a javascript error.

neao18neao18

I found out that if i remove https from my browsers address bas and load the visualforce page as http then the script load with no error.

bob_buzzardbob_buzzard

So is this a visualforce page exposed to a force.com site?

neao18neao18

No its not a VF exposed to a force.com site..

bob_buzzardbob_buzzard

Ah, okay so you aren't enforcing SSL for your Salesforce instance?

 

Can you access the https version of the resource directly via your browser?

neao18neao18

Yes i can access it through browser..

bob_buzzardbob_buzzard

I don't understand this I'm afraid - the script is loaded via the browser rather than via Salesforce, so the fact that you can load it directly via the browser indicates you should be able to access it via an include.  

 

When you switch to https, does the HTML markup to include the file look correct?

neao18neao18

Yes that is what i am saying .. and the markup are comming correctly..

bob_buzzardbob_buzzard

So how do you know that the script isn't loaded?  If the markup is generated correctly and you get no errors, that implies to me that it has been loaded.

neao18neao18

Because When using http the alert function is not called

But when using https the alert function is called.

 

 

bob_buzzardbob_buzzard

This is the first time you've mentioned an alert function - what does that do?