You need to sign in to do that
Don't have an account?
Maros Sitko1
Get URL of page inside Canvas app
Hi,
I have canvas app on my visualforce page. Everything is working, but sometimes I get some error page of 3rd party application, which is inside app. I need to find way, how to know that error page was shown in this 3rd party application (or get html content, where I will search for special string 'error'.
I am limited by editing 3rd party system, so I need put some javascript into my visualforce page, which will read the page inside canvas (3rd party application) and if it find 'error' I will do something.
I tried used jquery, but it said that it is security issue, so it will not allow me read context of iframe.
I found documentation 'Get Context in your Canvas App (https://developer.salesforce.com/docs/atlas.en-us.salesforce1.meta/salesforce1/canvas_custom_action_about_context.htm)' , but it is not working for me (probably I set it up wrong), I put this inside my visualforce
I tried to edit library of canvas https://github.com/forcedotcom/SalesforceCanvasJavascriptSDK/blob/master/js/canvas-all.js, where I created fucntion in services
Please can someone help me with it?
I have canvas app on my visualforce page. Everything is working, but sometimes I get some error page of 3rd party application, which is inside app. I need to find way, how to know that error page was shown in this 3rd party application (or get html content, where I will search for special string 'error'.
I am limited by editing 3rd party system, so I need put some javascript into my visualforce page, which will read the page inside canvas (3rd party application) and if it find 'error' I will do something.
I tried used jquery, but it said that it is security issue, so it will not allow me read context of iframe.
I found documentation 'Get Context in your Canvas App (https://developer.salesforce.com/docs/atlas.en-us.salesforce1.meta/salesforce1/canvas_custom_action_about_context.htm)' , but it is not working for me (probably I set it up wrong), I put this inside my visualforce
var client = Sfdc.canvas.oauth.client(); function test() { Sfdc.canvas.client.ctx(callback, client); }; function callback(msg) { if (msg.status !== 200) { console.log("Error: " + msg.status); return; } console.log("Payload: ", msg.payload); }but client ( Sfdc.canvas.oauth.client() ) has empty values.
I tried to edit library of canvas https://github.com/forcedotcom/SalesforceCanvasJavascriptSDK/blob/master/js/canvas-all.js, where I created fucntion in services
iframeUrl:function() { console.log(window.location); console.log(document); return{url:window.location} }from Visualforce I am calling Sfdc.canvas.client.iframeUrl(); , but it return me visualforce page URL not URL of iframe inside canvas
Please can someone help me with it?
Andy Boettcher
Unfortunately with Canvas - you're going to be very limited crossing the iframe barrier. I would instead focus on providing your users self-help instructions above the Canvas frame on how to recover if an error happens.