none
SharePoint Hosted Add-in ClientWebPart title is shown as an anchor tag - SharePoint Online(Office 365)

    Question

  • I have developed few SharePoint Hosted Add-ins.  I have added them to my SharePoint page. All the clientwebpart titles are pointing to their own appweb , when clicked they are redirected their own landing page. I don't want this to happen. What is the solution for this?

    Thanks in advance

    Tuesday, October 25, 2016 12:59 PM

Answers

  • Hi,

    We can use the following jQuery code to achieve it.

    <script src="//code.jquery.com/jquery-3.1.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
    	$(".ms-webpart-titleText a[href*='appredirect.aspx']").removeAttr("href");
    });
    </script> 

    Or we can use the CSS style below to hide the app web part title.

    <style>
    .ms-webpart-titleText a[href*='appredirect.aspx'{
    	display:none !important;
    }
    </style>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by Santosh S R Wednesday, October 26, 2016 9:38 AM
    Wednesday, October 26, 2016 9:11 AM
    Moderator
  • Hi Santosh,

    I missing the "]" in my code, please use this:

    <style>
    .ms-webpart-titleText a[href*='appredirect.aspx']{
    	display:none !important;
    }
    </style>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by Santosh S R Wednesday, October 26, 2016 9:55 AM
    Wednesday, October 26, 2016 9:41 AM
    Moderator

All replies

  • In the page where the app part is added, use the developer toolbar and find the dom element for the title and add  the css style as below

    pointer-events: none;

    Use appropriate selectors, if you have multiple webparts in the same page.


    ---
    Rajesh
    rjesh.com| @rjesh
    You don't need to buy me a beer, if helpful just smile, vote, and mark it as answer.

    Tuesday, October 25, 2016 11:54 PM
  • Thanks for your inputs Rajesh but the dom element has class .ms-webpart-titleText which is common to all the webparts so when i use pointer-events:none it is disabling all the webpart titles in page. I want only app parts titles not to be pointing anything? Other webparts should have the title url redirected. By the way, why this is happening - apps parts title redirecting to appweb urls?... any work around that can be made while developing the add-in itself?
    Wednesday, October 26, 2016 5:12 AM
  • Hi,

    We can use the following jQuery code to achieve it.

    <script src="//code.jquery.com/jquery-3.1.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
    	$(".ms-webpart-titleText a[href*='appredirect.aspx']").removeAttr("href");
    });
    </script> 

    Or we can use the CSS style below to hide the app web part title.

    <style>
    .ms-webpart-titleText a[href*='appredirect.aspx'{
    	display:none !important;
    }
    </style>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by Santosh S R Wednesday, October 26, 2016 9:38 AM
    Wednesday, October 26, 2016 9:11 AM
    Moderator
  • Hi Dennis,

    Your jQuery code works superb but css do not have any impact. Can you please help me with CSS part?

    Thanks,

    Santosh
    Wednesday, October 26, 2016 9:39 AM
  • Hi Santosh,

    I missing the "]" in my code, please use this:

    <style>
    .ms-webpart-titleText a[href*='appredirect.aspx']{
    	display:none !important;
    }
    </style>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by Santosh S R Wednesday, October 26, 2016 9:55 AM
    Wednesday, October 26, 2016 9:41 AM
    Moderator
  • Dennis,

    This completely hides the title which should not happen. Only redirection should be prevented . If this is not possible with the CSS I will do it with script as an alternative. 

    Any idea why apps parts title redirecting to appweb urls ?

    Thanks,

    Santosh

    Wednesday, October 26, 2016 9:55 AM