I have a CEWP with an image. The URL takes you to the pages library and selects the content type specified in the URL. I need to make the cancel button take you back to the home page of that site. At the moment it redirects to the site settings.

<a title="Create News Article" href="/team/communications/news/_layouts/15/createpage.aspx?source=" target="_blank" home.aspx"list="7BEF313E0C%2D6D16%2D4FEE%2DAA81%2D1097721207B67D;RootFolder=/team/communications/news/Pages&amp;ContentTypeId=0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D000F6AAE38AC4E3D41A4AFABC6180DF3B508001CF7C87B173FAF4799ACE88DD0B55D3A&quot;"><img class="ms-rtePosition-2 ms-rteImage-0" src="/team/sales/Style%20Library/Images/WhiteIconCreateNews.png" alt="" style="margin: 5px;"/></a>

you can use this script to make you take to the home page of the site

<div style="width: 100%; text-align: left;">

    <INPUT TYPE="button" VALUE="Cancel to Homepage" CLASS="ms-ButtonHeightWidth" style="width:120px; background-color:transparent" onclick="parent.location='http://Sitename/Pages/Home.aspx'" title="Homepage" />

and what is this in your code

  • That adds a new button. Is it possible to place it in html of the link rather than add a new button to the page? – Mike Blair May 8 '15 at 13:54
  • do you want to add in the above link or in another link – Manish Oswal May 8 '15 at 13:56
  • In the above link – Mike Blair May 8 '15 at 13:57
  • are you trying to add the link to the image in CEWP? Do you want that when you click on the image you should be able to go back to home page right ? – Manish Oswal May 8 '15 at 13:59
  • home.aspx shouldn't be there. Left over from an attempt to get it to work I used source=/~sitecollection/homepage.aspx – Mike Blair May 8 '15 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.