0

I am currently trying to migration my company's Salesforce from Classic to Lightning Experience. However, the readiness report VF says the following:

JavaScript included in this page uses window. methods. Included JavaScript uses window. methods for navigation, which are not supported in Lightning Experience. Use the sforce.one navigation method instead. For more information see the Lightning Component Developer Guide

The code with the issue is below:

$.cometd.init({  
  url: window.location.protocol+'//'+window.location.hostname+'/cometd/24.0/',  
  requestHeaders: { Authorization: 'OAuth {!$Api.Session_ID}'}  
});  

It seems that there are two methods to replace - window.location.protocol and window.location.hostname - but I couldn't find any sforce.one method which can replace these two.

Could anyone please help?

Thanks very much for your help

1 Answer 1

0

What you are really trying to do is load the CometD library, presumably for the use of Streaming API or the like.

If the code you're using is located in Visualforce I think this issue is a false positive. Visualforce in Lightning operates in an iFrame. When the Visualforce uses window.location it will get the Visualforce domain info and probably work fine.

All that said, I don't know why it couldn't just use a relative URL '/cometd/24.0/'.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .