Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John C Scott 473 posts 1183 karma points
    Sep 21, 2018 @ 12:57
    John C Scott
    0

    Preview Not Working

    I'm using 7.12.3 When I hit preview I don't get a preview page. When I look at sources in the inspector I see that the /umbraco part of the URL is missing. There's a lot of URL rewriting going on with the site and I'd assume that's the problem however I'd assume that for example where I'm getting for example: http://myurl.com/assets/css/canvasdesigner.css

    If this were due to rewriting if I typed: http://myurl.com/umbraco/assets/css/canvasdesigner.css

    the URL would be written to http://myurl.com/assets/css/canvasdesigner.css

    It's not, it serves the CSS file as expected. Any other ideas as to what could be the cause of this?

    The URLs from the page source of the page: http://myurl.local/umbraco/preview?id=41703 are

    <link href="../assets/css/canvasdesigner.css" type="text/css" rel="stylesheet" />
    <link href="../lib/spectrum/spectrum.css" type="text/css" rel="stylesheet" />
    <link href="../lib/jquery-ui/jquery-ui-1.10.4.custom.min.css" type="text/css" rel="stylesheet" />
    

    any suggestions greatfully appreciated.

    The changed parts of the app settings in the web.config which are not standard are

        <add key="umbracoHideTopLevelNodeFromPath" value="false" />
        <add key="umbracoUseDirectoryUrls" value="true" />
    

    Is probably worth mentioning that this is an upgrade from a 7.4 site

    & also that this is what it looks like: enter image description here

  • Tom Ruddock 3 posts 24 karma points
    Oct 25, 2018 @ 11:06
    Tom Ruddock
    0

    I'm having this exact issue following an upgrade from v7.5.9. I'm still having a poke around myself, but any help would be hugely appreciated.

  • Tomas 5 posts 27 karma points
    Oct 26, 2018 @ 08:42
    Tomas
    0

    Having the same issue after upgrading from 7.6.9 to 7.12.1. Would love to hear about any progress!

  • Kristoffer Jensen 2 posts 74 karma points
    Dec 02, 2021 @ 11:51
    Kristoffer Jensen
    0

    Hi Thomas, We have found a solution at my office, i have posted the code below :)

  • Tomas 5 posts 27 karma points
    Oct 26, 2018 @ 10:07
    Tomas
    2

    Turned out is was a rewrite rule to remove trailing slash that caused this issue. Not sure exactly why but removing it made all the difference.

  • Yevhenii_Koliesnik 3 posts 73 karma points
    Aug 11, 2020 @ 12:14
    Yevhenii_Koliesnik
    0

    Yes, u are exactly right ! Even in 2020 you answer helped me with supporting. Works for me.

  • Kristoffer Jensen 2 posts 74 karma points
    Dec 02, 2021 @ 11:14
    Kristoffer Jensen
    2

    Hey i have experienced the same issue. we fixed this by making some changes in the .js files that run the preview.

    in umbraco.canvasdesigner.js we changed line 22 to the following

    $scope.pageUrl = '/umbraco/dialogs/Preview.aspx?id=' + pageId;
    

    in

    and in views\Preview\index.cshtml the following

    line 10,11,12

    <link href="/umbraco/assets/css/canvasdesigner.css" type="text/css" rel="stylesheet" />
    <link href="/umbraco/lib/spectrum/spectrum.css" type="text/css" rel="stylesheet" />
    <link href="/umbraco/lib/jquery-ui/jquery-ui-1.10.4.custom.min.css" type="text/css" rel="stylesheet" />
    

    line 29,30,31

    <img ng-src="/umbraco/assets/img/application/logo.png"
                     ng-srcset="/umbraco/assets/img/application/[email protected] 2x,
                    /umbraco/assets/img/application/[email protected] 3x" />
    

    and line 148 and 149

    <script src="/umbraco/lib/rgrove-lazyload/lazyload.js"></script>
    
    
    
    
    <script src="/umbraco/js/canvasdesigner.loader.js"></script>
    

    in the canvasdesingner.loader.js file, you want to edit the url so it can be found. This is how the file looks after the changes:

    LazyLoad.js([
      '/Umbraco/lib/jquery/jquery.min.js',
      '/Umbraco/lib/jquery-ui/jquery-ui.min.js',
      '/Umbraco/lib/angular/1.1.5/angular.min.js',
      '/Umbraco/lib/underscore/underscore-min.js',
      '/Umbraco/lib/umbraco/Extensions.js',
      '/Umbraco/js/app.js',
      '/Umbraco/js/umbraco.resources.js',
      '/Umbraco/js/umbraco.services.js',
      '/Umbraco/js/umbraco.security.js',
      '/Umbraco/ServerVariables',
      '/Umbraco/lib/spectrum/spectrum.js',
      '/Umbraco/js/umbraco.canvasdesigner.js' 
    

    ], function () { jQuery(document).ready(function () { angular.bootstrap(document, ['Umbraco.canvasdesigner']); }); });

    what the code does, is to change the paths to the files, so they fit with what the preview is asking for :)

    Hope it helps someone

  • Simon steed 376 posts 688 karma points
    Mar 29, 2022 @ 10:06
    Simon steed
    0

    I've just had exactly the same problem on a clients live site, however their staging site was working fine.

    The fix Kristoffer posted works fine - however i'd love to know why it's suddenly broke, currently got staging still using the old code and live using the new :-)

  • Richard Ockerby 34 posts 209 karma points MVP 4x c-trib
    Oct 20, 2024 @ 22:34
    Richard Ockerby
    1

    Bit of an old thread, but I just ran into this problem. I can see why the code above would fix it, so I dug a little deeper. We had a rewrite rule setup to remove trailing /, and because the preview URL is /umbraco/preview/, it was then transformed to /umbraco/preview which then broke all the relative URLs!

    Here's the amended IIS rewrite rule config, should anyone find it useful:

    <rule name="RemoveTrailingSlashRule1" stopProcessing="true"> <match url="(.*)/$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="true"> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_URI}" pattern="^/umbraco/" negate="true" /> </conditions> <action type="Redirect" url="{R:1}" /> </rule>

Please Sign in or register to post replies

Write your reply to:

Draft