Tagged: cornerstone
-
AuthorPosts
-
March 26, 2017 at 9:29 pm #1421105
Hi there,
The title pretty much says it all. There’s a page where I used Cornerstone ( -> Page settings > Custom JS ) to add a javascript redirect to the page (so any visitors are redirected to another). But because the page still loads first, I need to remove a few bits and pieces of the page itself (that are displayed right before the visitor gets redirected). Also, I’ll need to remove the Custom JS at a later point.
Problem now is that I can’t get Cornerstone to load properly, so I can edit the page or its cornerstone settings. My browser’s javascript console displays the following issues:
gogodstlfrqyausf.js:1 XHR finished loading: POST "__REDIRECT TARGET__/gogodstlfrqyausf.js?PID=D2D5BDA6-C901-3B28-9A56-B1F4D2A765F6". r @ gogodstlfrqyausf.js:1 (anonymous) @ gogodstlfrqyausf.js:1 (anonymous) @ gogodstlfrqyausf.js:1 (anonymous) @ gogodstlfrqyausf.js:1 __REDIRECT TARGET__:1 Refused to display '__REDIRECT TARGET__' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'. builder.min.js:1 Uncaught DOMException: Blocked a frame with origin "__DOMAIN__" from accessing a cross-origin frame. at n.loadIFrame (__DOMAIN__/wp-content/plugins/cornerstone/assets/dist/js/admin/builder.min.js:1:11259) at HTMLIFrameElement.dispatch (__DOMAIN__/wp-includes/js/jquery/jquery.js:3:12444) at HTMLIFrameElement.r.handle (__DOMAIN__/wp-includes/js/jquery/jquery.js:3:9173)
Sorry I can’t provide the actual link. Hope it helps anyway 🙂
March 27, 2017 at 1:17 am #1421231Hi there,
If you want to redirect any page then you can use a plugin like this – https://wordpress.org/plugins/redirection/ or do with .htaccess. We are not aware of your code so not sure why it doesn’t work as expected.
Thanks!
March 27, 2017 at 8:59 am #1421630Hi Rupok,
Yes, sorry, my bad. I used a basic javascript window location replace. In the page source:
<script id="cornerstone-custom-page-js">;window.location.replace('__REDIRECT_TARGET__');</script>
March 27, 2017 at 9:51 am #1421736Let us know if we can help with anything else. 🙂
March 27, 2017 at 10:39 am #1421806Yes! Help with this issue! o.O
So as I said, Cornerstone will not load properly after I’ve saved the page with the above Javascript in the page settings. How can I get Cornerstone to load properly?
March 27, 2017 at 11:18 am #1421835We’re sorry but this custom programming is outside the scope of our support. You might want to contact our trusted partners who caters X setup and customization needs. Please see https://community.theme.co/custom-development/
Thank you for understanding.
March 27, 2017 at 11:53 am #1421887This is becoming a little frustrating guys.
It is NOT bloody custom programming.
You HAVE a field in Cornerstone that allows for snippets of javascript in the page.
window.location.replace('__REDIRECT_TARGET__');
It’s NOT anything COMPLEX. It just blocks Cornerstone from loading.
I need a way to load the page editor DESPITE the code snippet.
OR a way to remove the snippet without breaking the Cornerstone layout.Now DO something and HELP me instead being profesionally obtuse.
I’ve been buying X licenses like hotdogs these past few months. Now someone better make it worth my while because this is not exactly encouraging me to continue. I’m happy to co-operate and provide any information necessary, but this lazy and evasive attitude must stop immediately.
March 27, 2017 at 11:34 pm #1422569Hi There,
Since you have seen that Cornerstone will not work with that code because of the conflict of redirection we have to remove that line of code. We can save a backup of your page. Click Layout Tab > Template > Save> Try to choose Download so you have a CSL template of that page. Then now, you can remove that code and save your page again. Your page should be the same and in case it’s not, we can always load that template we have save as backup.
Hope this helps.
March 28, 2017 at 5:42 am #1422831Hi Lely, thanks for at least trying. Unfortunately, Cornerstone won’t even load to begin with. It’s just stuck on the load-screen permanenetly. Any other ideas?
March 28, 2017 at 8:57 pm #1423741Hello Meng,
Would you mind providing us with login credentials so we can take a closer look? I tried to add the same code on my test site in Cornerstone. It just not load the preview but at least Cornerstone is loading so I am able to remove the code. To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / password
– Page with issue.Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.
March 29, 2017 at 7:36 pm #1424739Never mind, Lely, but thanks for your help!
I solved the problem by going into PhpMyAdmin and editing the post_meta table’s _cornerstone_settings row corresponding with the page’s post_id. Originally, the value was
{"custom_css":"/*nNo need for style tags here;nsimply get started by writingnCSS! Watch as your changesnare reflected live in thenpreview area. Have fun!n*/nn","custom_js":"//n// No need to add script tagsn// here; simply get startedn// by writing JavaScript!n// Remember to save yourn// changes to see them :)n//nnwindow.location.replace("https://www.indiegogo.com/projects/travis-i-speak-80-languages-so-can-you-travel#/");","custom_js_mini":";window.location.replace('https://www.indiegogo.com/projects/travis-i-speak-80-languages-so-can-you-travel#/');","responsive_text":[]}
And I copy-pasted the ‘blank’ version to it
{"custom_css":"/*nNo need for style tags here;nsimply get started by writingnCSS! Watch as your changesnare reflected live in thenpreview area. Have fun!n*/nn","custom_js":"//n// No need to add script tagsn// here; simply get startedn// by writing JavaScript!n// Remember to save yourn// changes to see them :)n//nn","custom_js_mini":"","responsive_text":[]}
…
For your reference:
The factors I suspect contributing to this issue are two-fold:
- A page using Cornerstone which has the window.replace entered as ‘Custom Javascript’ (which is saved into the cornerstone settings postmeta field), not raw code lobbed somewhere in the page
- A redirect target that gives back an X-Frame-Options response header of ‘SAMEORIGIN’ or ‘DENY’, which causes issues with the pagebuilder.js in Cornerstone that in turn freezes the loading process
I’ve been able to edit the page and solved it by doing the following:
- Going into PhpMyAdmin and finding the right corresponding postmeta table row for cornerstone settings to remove the interfering code
- Being able to edit the page again, edit it and place the javascript redirect as a raw html element somewhere on the page between
<script></script>
tags. Lower in the page means it becomes more visible before redirecting, higher means faster execution.
March 29, 2017 at 11:04 pm #1424949Hello There,
Thanks for sharing this information. We are just glad that you have figured it out a way to correct the said issue.
We really appreciate for letting us know!Best Regards.
March 30, 2017 at 6:34 am #1425220Pleasure. Please take note in future Cornerstone development to include a way to load directly into skeleton mode if the pagebuilder won’t load properly, for example, due to unwanted/unexpected script execution of the page to be edited. Much like the lack of WP revision support, these should be basic functionalities that must be supported on your average page – not features to be added later.
March 30, 2017 at 8:53 am #1425302Hi,
We’ll surely take note of that.
Thanks for sharing. Have a nice day! 🙂
-
AuthorPosts