Closed panoply closed 5 years ago
Hey @panoply - unable to replicate on my side and I verified and window.Shopify.designMode
is not deprecated.
I added a quick test in my theme.js
file like this :
if (window.Shopify.designMode) {
console.log('designMode working');
}
and you can see that it's working when i'm in the editor :
FWIW @panoply you can't just open up dev tools and test it on the Top part you need to change it to your sites iframe to test like @huguestennier did.
Hey guys, getting undefined
my end when using theme editor frame.
I managed to get this working, while I'm unsure of the actual cause as none of these aspects should of affected the Shopify window object my best guess it was a combination of things which caused the undefined
result. I wasn't able to dissect the root cause but below is a list of possible candidates and steps I took which eventually resolved the issue. Hopefully this might help someone someday.
The Shopify store domain is using cloudflare so as to take advantage of /cdn-cgi/trace
endpoint for GeoIP functionality. Below are some key aspects which may have contributed to the issue which I modified which may have helped.
I use a proxy client which ships with a bunch of default "security" settings and it was applying a sandbox
attribute to not all but only some iFrames so logically I disabled these default "extra" settings. If anyone has a proxy client or third party application that has access to the browser DOM it is worth ensuring that it's not causing issues.
I am using uBlock in combination with Ghostery and while I never had any issues prior with these extensions or any extension affecting a website window object, disabling these before using the theme editor may have resolved the issue.
@panoply From all the theme support we provide to thousands of shops, CloudFlare 100% of the time causes problems with shops, especially in the theme editor. When we have a support email where the merchant is having issues with the editor one of the first things we check is if they're using CloudFlare.
@jonathanmoore tbh, I was leaning towards Cloudflare being the cause regarding this strange issue I encountered. I tested this with a bunch of stores all of which are using cloudflare and all returned the same undefined
result which led me to believe that window.Shopify.designMode
had been deprecated. I am now wondering if it may had been the proxy client considering Flems didn't work for me yesterday.
Moving forward I just hope to never encounter this issue again, it was extremely frustrating and kept me awake for far too long.
running Shopify.designMode
returns true
when you run it inside the iframe on customizer where the actual rendered html is.
It seems that the
window.Shopify.designMode
boolean is deprecated – I've tested this with several stores and multiple browsers with an undefined result every time.