I'm using SP Online with Oslo layout.
The home page has a hyperlink (i.e.<a href="..../newform.aspx">Create Your Profile</a>)

Is there a way open the URL in modal?

I found similar postings and tried the solution from this post but I couldn't get it to work. Each time I published the site, the code is stripped by the system.

Similar issue when I used the solution from this article.



With the second article you posted, what order do you have the webparts? Make sure you're adding the script editor webpart on top of the content editor webpart with the hyperlink. Otherwise, your function won't load first and the link won't work.

  • I have it at the bottom. I'll try this now and post back. Thanks Kelvin. Jun 22 '17 at 17:19
  • It still didn't work. After I added the code in Script Editor and placed it on top, I inserted the following on the page <a href='javascript:displayLayover("/Lists/Staff%20Directory/NewForm.aspx?IsDlg=1")'>CREATE YOUR PROFILE</a> but after saving it, SP changed it to <a>CREATE YOUR PROFILE</a> - it stripped the rest. Jun 22 '17 at 17:23
  • Also make sure you have the function in the Script Editor WebPart and the hyperlink in a Content Editor Webpart or you may come across the issue with the code being stripped out. Jun 22 '17 at 17:24
  • Are you just dropping the <a href='javascript:displayLayover("/Lists/Staff%20Directory/Ne‌​wForm.aspx?IsDlg=1")‌​'>CREATE YOUR PROFILE</a> into the Content Editor WebPart? Make sure you're selecting the webpart and then clicking 'Edit Source' in the ribbon and dropping your link in there. Jun 22 '17 at 17:26
  • No, I do click on 'Edit Source' when I use the CEWP. Also it worked when I created the link inside the CEWP but had to changed the link to <a href='javascript:displayLayover("/Lists/Staff%20Directory/Item/newifs.aspx?IsDlg=1‌​")‌​'>CREATE YOUR PROFILE</a> Thanks you so much Kelvin! Jun 22 '17 at 17:52

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.