Skip to main content
2 of 3
added 7 characters in body

Querying and manipulating the DOM elements can be done in SPO Page through App part (Client hosted web part) even though its run inside the iframe on the hosted web page.

To do this, you need to wire-up the web part properties with query string as suggested by John-M and I tried few approaches and found none except this idea.

SP.RequestExecutor.js doesn't help me to have cross domain call for the purpose of identifying the DOM element on the SPO page via Client hosted webpart which is placed on the same page.

On searching, I found the magic line of Javascript code document.domain="your domain". This has to be placed on your SPO Page and as well in App Part. Now I am able to query the DOM element after this mutual understanding been created between the Client hosted webpart (App Part) and the SPO Page.

Consider this scenario, if a page had two field and wanted to change the color of the any of the field,then you must aware of the Field id that need to pass it as querystring to your app part placed on yet resides on the other domain. Logic need to be written inside your app part as outlined on my personal blog posted some time ago. http://intelliview.blogspot.in/2014/03/sharepoint-app-custom-properties.html.