Show and hide DIV in UIWebView based on keychain iOS Xcode -


how hide , show div based on value array?

i've figured out how edit div in uiwebview using following:

-(void)webviewdidfinishload:(uiwebview *)jswebview {     // replace <div id="footer"> in webpage <img> instead.     nsstring *jsstuff = [jswebview stringbyevaluatingjavascriptfromstring:@"document.getelementbyid('footer').innerhtml='<img src=\"http://url.to.image.png\">'"]; } 

i have nsarray populated active directory groups person member of. array pulled keychain using library tied app , populated different each person depending on group they're in.

so, need figure out how show , hide div in uiwebview based on if they're in particular group or not. have each div labeled unique id, i'm thinking 'getelementbyid' work identifying div which. how match them similar this:

if(nsarray contains thisvalue) { divid.visible =  show; } else { divid.visible = hide; } 

edit: ended adding values array query string, , used javascript evaluate , show/hide different divs based on finds in query string.

same way, using stringbyevaluatingjavascriptfromstring method. basic example be:

if(nsarray contains thisvalue) {    // show    [jswebview stringbyevaluatingjavascriptfromstring:[nsstring stringwithformat:@"document.getelementbyid('%@').style.display='block'", divid]]; } else {    // hide    [jswebview stringbyevaluatingjavascriptfromstring:[nsstring stringwithformat:@"document.getelementbyid('%@').style.display='none'", divid]]; } 

where divid nsstring desired div id.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -