Preview not working

My preview functionality was working earlier now it’s not working,

And I see some deprecation warnings in console ( ref to screenshot)
although i have copied the script from Settings > Previews > Script

I have tried changing the script to the suggested one in console. On changing the script my preview still isn’t working and i see a parse error:

Error: Parse Error: <script async defer src=// ?repo=example-repo&new=true></script>

Can someone help me with this

Hi @Ujjwal,

Welcome to the community!

I see that there a space between prismic.js and ?repo in the script:
<script async defer src=// ?repo=example-repo&new=true></script>

Is this just a copy and paste error?

Hi @Phil,

No , there is no space in actual code. This error was copied from console output maybe that’s why there is an extra space.

Also i was wondering is New toolbar activated for my account ? ( maybe not toolbar is not activated that’s why i still see old script in Settings > Previews > Script )

That’s correct, if you still see the old script without new=true like so…

  window.prismic = {
    endpoint: ''
<script type="text/javascript" src=""></script>

Then this is the recommended script for you repo.

  window.prismic = {
endpoint: ''
<script type="text/javascript" src=""></script>

i see this script in my account’s Settings > Previews > Script. is this correct ?

and what about console warning suggesting to use

<script async defer src=//></script>

which one is correct ?

The correct one is the one suggested in your repo settings.

We are in the process of updating our documentation to make this clearer and I’m going to contact the dev team to make that console warning that you’re seeing clearer.

Ok i’ll wait for the documentation and the clearer console warning meanwhile I’m using script from setting of my repo ( although i still see deprecation warning) .

Can you help me understand why has my preview functionality stopped i have tried debugging everything is same ( from the time it was working).

Have gone through the troubleshooting page as well

Everything seems fine, i tested the rest API as suggested in troubleshooting page

got this response

"label": "Live now",
"ref": "X1nbERAAAB_RYrpo",
"mainDocument": null,
"type": "LIVE"

is this correct ?

What could be the issue with preview cause it is redirecting me to correct page and rendering the blank page there.

I can’t say off the top of my head.

Can you try doing the preview in a different browser?

If you see no change can you send me a private message with a zip of your project and the url of your repo so I can test on my side?


This issue has been closed due to inactivity. Flag to reopen.

Hi @Jaakko ,

If you're seeing the button then the toolbar you've added should be fine.

Did you add the preview path and script to all your pages? as described in the react docs here:

Thanks for your quick answer. I got the preview working when I'm logged into Prismic and go into preview via the eye button. I see my saved but not published changes with a Prismic toolbar.

Only thing I can't get to work is the share link. When I open the Prismic generated link in incognito browser, I see only published changes, not the saved ones. Any pointers on this one?

Hey Jakko,

This is most likely because our preview system uses cookies to build previews on top of your website application in the browser, so maybe you have cookies turned off in incognito?

That's true. And when previously testing also with Safari, it didn't work either. Gladly the Troubleshooting site mentioned the cross-site cookie prevention being on by default.

Everything works now. Thanks @Phil!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.