Featured post
javascript - sharepoint breadcrum trail editing on the fly -
i have been searching hours , have found code claims able want however...it doesn't.
i trying remove pages , .aspx off end of page name in breadcrumb trail in sharepoint. like.... mysite > myarea > pages >mypage.aspx
i have tried changing sitemapprovider , takes away pages link current page. looked like.. mysite > myarea.
i have mysite > myarea >mypage have tried using snippet of code...i not claim own or have developed code.
var breadcrumbs = document.getelementbyid('ctl00_placeholdertitlebreadcrumb_contentmap') if (breadcrumbs != null) { if (breadcrumbs.childnodes.length >= 3) { if (breadcrumbs.childnodes[2].innerhtml.indexof('pages') > 0) { breadcrumbs.childnodes[1].innerhtml = ""; breadcrumbs.childnodes[2].innerhtml = ""; } } }
i put document.writes in see code getting , breadcrums variable seems null therefore code never gets juicy part :p
any ideas hints tips hugely appreciated
truez
i have run code on sharepoint site , able breadcrumbs element fine. have verified that correct id of breadcrumbs object. id use default, should check. view source on page , quick ctrl-f , search "breadcrumb".
too see if matter of placement, this: on target sharepoint page using ie, open web developer tool (tools > developer tools). switch script tab , press multi line mode button @ bottom of script pane. paste code:
var breadcrumbs = document.getelementbyid('ctl00_placeholdertitlebreadcrumb_contentmap') if (breadcrumbs != null) { if (breadcrumbs.childnodes.length >= 3) { if (breadcrumbs.childnodes[2].innerhtml.indexof('pages') > 0) { breadcrumbs.childnodes[1].innerhtml = ""; breadcrumbs.childnodes[2].innerhtml = ""; } else { alert('pages node not found!'); } } else { alert('breadcrumbs has ' + breadcrumbs.childnodes.length + ' children!'); } } else { alert('breadcrumbs not found!'); }
then press run script button. code yours alerts added see if/where fails. if no alerts , breadcrumbs element changes expect yes placement. otherwise, depends on alert get. let me know results , can correct issue.
- Get link
- X
- Other Apps
Comments
Post a Comment