on 10-26-2015 3:20 PM
Hi all,
i am using iframe inside my XML views , i need to change the src attributes of the iframe dynamically,
in that i am using google doc viewer
while i am trying to set src of iframe its giving 'SAMEORIGIN' issue,
but if we fixed the same url then it is working fine.
below code is for iframe in xml view,
<html:iframe target='_top' src="https://docs.google.com/viewer?url=http%3A%2F%2Ftsddev.cname.net%2Fecomm%2FAGR0000000005.pdf&embedde..." id ="attachmentframe" height="100%" width="100%">
</html:iframe>
if user clicks on a button i am trying to change the src of iframe as follows
document.getElementById("__xmlview4--attachmentframe").src = pathFormed
if we are placing the same url in pathFormed varaibale it will giving error.
can you any one help .
Thanks
Kotesh.
Hi all,
Here is my code for iFrame,
in XML View
<html:iframe target='_top' src="" id ="attachmentframe" height="100%" width="100%">
</html:iframe>
in Controller i tried in two ways
var pdfUrl = "https://docs.google.com/viewer?url=http%3A%2F%2Fvtxdev.Pivog.net%2Fecomm%2F3M%2F0000006673%2Fdocumnt..."; | |
// $('#'+this.getView().byId('attachmentframe').sId).attr("src",pdfUrl); | |
document.getElementById("__xmlview4--attachmentframe").src = pdfUrl; |
after this if we are checking the src of the iframe it is getting empty and as well as getting SAME-ORIGIN" error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karthik,
if i am trying above example i am getting error like below
"in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'."
if we are directly given the url of the iframe it is working fine otherwise it's getting same origin error.
Thanks
Kotesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kotesh,
Try like this:
var oFrame = sap.ui.getCore().byId("__xmlview4--attachmentframe"); //Get Hold of iframe
var oAttributes = oFrame._xContent.attributes; //iframe Attributes
var oValues = {"target": oAttributes[0].value, "src":oAttributes[1].value, "id":oAttributes[2].value, "height":oAttributes[3].value, "width": oAttributes[4].value}; //Attribute Values
alert(JSON.stringify(oValues)); //Alert the Attributes
Check the sample here: Plunker
Once you got hold of the attributes, I hope you know how to change them.
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.