0

I made a button that points to a specific URL on my SharePoint site. When I add my button using "Edit HTML Source" and save SharePoint changes the absolute URL to a relative URL which causes my button to not work.

Should I be doing something differently? When I open my button in a browser it works fine using the full URL, it is only when I add it to SP2010 that the shortened URL doesnt work.

In addition to directly editing the source html for the web part I have also tried linking to an html and text file, both of which get the url shortened by SharePoint.

Thanks in advance for any help.

1 Answer 1

0

This is a security feature implemented by Microsoft to avoid cross site scripting. Because of this feature, SharePoint changes the absolute URL to a relative URL.

The only OOTB way to surpass this is by putting your content in a .txt file, Upload it to some location within your SharePoint and using Content Link.

If you still not able to get it then kindly check the answer at below article.

referring to files in style library from content editor web part

4
  • Thanks, but when I try that it changes the URL I am using to a link for the page the button is on. Specifically, the button is on the home page and when I use the text file the button takes the user back to the home page instead of to the url specified in the txt file. Any thoughts on why?
    – user56061
    Jun 10, 2016 at 15:21
  • I am not getting you point. I understood that you need button on home page using CEWP. The button have the link applied on it. & that link on the button changes from absolute to relative. Am i correct? Please correct me if i am worng
    – Hardik
    Jun 10, 2016 at 15:37
  • Yes, it changes from absolute to relative and the relative link does not work - the button returns the user to the page the button is on instead of taking them to the page the link is for.
    – user56061
    Jun 10, 2016 at 16:44
  • If you can share me your code than I will try to help you.
    – Hardik
    Jun 10, 2016 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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