Blocked a frame with origin "<mydomain>" from accessing a frame with origin "https://www.facebook.com" - facebook

First of all, I checked this post already: Facebook: Unsafe JavaScript issue (document.domain values should be same)
But that is about a page on Facebook. The error I'm getting in my Chrome console on a page on my own website is:
Blocked a frame with origin "<mydomain>" from accessing a frame with origin "https://www.facebook.com". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "https". Protocols must match. fckeditorcode_gecko.js:36
To be sure, I logged out from Facebook, but still the error occurs.
line 36 in fckeditorcode_gecko.js:36 starts with:
var FCKTools={};FCKTools.CreateBogusBR=function(A){var B=A.createElement('br');B.setAttribute('type','_moz');return B;};
How to fix this?

This seems to be a conflict between FCKEditor library and a library of facebook you included in the page. Probably the Like Button, I had the same with +1 button of Google Plus with api.google.com.
Quick Fix: Remove one the 2 library
Your FCK Editor library seems old also, you can update it here:
http://ckeditor.com/
Another quick hack to fix it. But I'm not sure of the side effect:
open "fckeditorcode_gecko.js":
CTRL+F to search the string:
"if (A.document) A.document.parentWindow=A"
and replace it with
"return"
Best,

You can't, due to the Same Origin Policy.
It appears you are trying to add a <br> tag to the document in the frame. The domain, protocol and port must match for you to achieve this, or CORS must be implemented by the requested resource in the frame.

I had the same problem with ckeditor (image uploader).
Here is what I have in htaccess:
RewriteCond %{HTTP_HOST} ^www\.yousite\.co\.il
RewriteRule ^(.*)$ http://yousite.co.il/$1 [R=301,L]
Anyone trying to hit www will get redirected to the site without www.
However, my admin page does not use the same htaccess rules and when I try to send ajax request with file from www.mysite/admin to mysite/admin and this create this problem.
Adding www to the url admin page string made it all work.

Related

Change Umbraco 'redirect to' to use 301 instead of 302

I'm using Umbraco 7.0.1 and want to change the default redirect behavior from returning a 302 to return a 301.
So I have a page: /het-obam-perspectief/nieuws/ that redirects to /nieuws/.
I have set this up in the Umbraco CMS:
When the request comes back I get a 302 (as captured in Fiddler):
Is there a way to reconfigure the default redirect behavior? I've looked around the web and only seen instructions for changing redirect behavior when changing domains (stackoverflow.com/questions/16357712/umbraco-301-redirect-entire-site) or managing each redirect url manually (http://our.umbraco.org/projects/developer-tools/301-url-tracker), neither of which satisfies what I'm trying to do.
After doing some research, Umbraco's default behavior for the umbracoRedirect property is automatically a 302, and cannot be changed.
There's (2) different options that we have here.
Configure the redirect in either IIS or web.config for the 301
using URL rewriting.
I found this package (haven't tested nor installed), but looks very
promising. Seems to basially create a new doc type name
umbracoPermanentRedirect and is of type Content Picker, which
then does a 301.
Umbraco Perm Redirect
I'd go w/ option (2) since this is the behavior that acts like Umbraco's default property.
Please let me know how this goes b/c our company heavily uses SEO best practices and I'd get pinged on this 302 as well if I had need for redirects.
Apprec.

How to do popup on new site for 301 redirected users?

I have just migrated a site to a new domain (with new design) and am redirecting from the old site to the new with .htaccess and redirect 301. Since the new site is quite different, I'm concerned that users might be disoriented. Is there a way to have a popup on the new site that users get only if they have been redirected from the old site? Have been searching on this but keywords seem to lead only to stuff on popup redirects to another site.
I can think of several ways to do it:
Redirect in the 301 to another page (www.blah.com/tour instead of www.blah.com) and there i would put the logic to show the popup
Redirect in the 301 to another page and there set a cookie and redirect to the original page. Then, add logic to the original page to show the popup if the cookie is present (and delete the cookie)
Check the referrer in the new site and if it matches the old one, show the popup
Your problem boils down to detecting a request that has come via a 301 redirect - popups and usability are a separate (simpler?!) issue.
Unfortunately, detecting a 301 redirect is one of those inexact things that requires a mixture of techniques to get near to 100%. I say near, but never quite there - a bit like browser detection.
One option is to append a querystring (GET) parameter to the redirected URL, e.g.
www.example.com/LandingPage.html?isRedirected=true
You could also set the same info in a cookie (but won't work if cookies are disabled or cleared).
Another option is checking the Referrer header - but again, these may differ based on browser implementation and can be faked, although if someone's faking a redirect I don't think you need to worry about guiding them through your new design!

URL Rewriting and Facebook link information retrieval

I am developing a website and I want to integrate it with Facebook, allowing users to share the pages of my website in their FB walls. My problem is explained in the following lines and my question is at the end.
I am using the following URL rewriting rule in my .htaccess file:
RewriteRule ^([a-zA-Z0-9_-]+)\/?([a-zA-Z0-9_-]+)\/?$ index.php?p1=$1&p2=$2
That means it will rewrite anything like: http://address/parameter1/parameter2 as http://address/index.php?p1=parameter1&p2=parameter2.
When I post http://address/parameter1/parameter2 on FB, it will only show the rewritten URL under that URL.
I posted http://address/index.php?p1=parameter1&p2=parameter2 on FB, and it will show the information I want it to show, the ones I have put in the meta tags.
I tried debugging http://address/parameter1/parameter2 on the FB debugger (http://developers.facebook.com/tools/debug), I will get the error:
"The page at ... could not be reached because the server returned status code 400."
Is there any way I can correct that? That is, actually making the dynamic link behave like a static link, and making that transparent to anyone who links it?
Edit:
This change in the rewrite rule should solve the problem:
RewriteRule ^([a-z0-9_-]+)/?([a-z0-9_-]+)/?$ index.php?p1$1&p2=$2 [L,NC]
I also changed the redirects in PHP that I was doing.
And that solved my problem.
I have similar issue to yours, except I manage url rewriting with php dynamically.
I am currently a web host that do not allow url rewriting through htaccess (free.fr)
dynamic standard url is handled properly. But not rewrited url.
How would you get rid of this, considering header status code?
What I could do is doing a redirect instead of include script which produce html output code.
Just have to tell the handler to switch between include and redirect, thanks to a special added param in the url.
But it's not a pretty solution.

Sitewide 301 Redirect

I am looking to perform a sitewide 301 redirect. The original site is over 15 years old! I understand the concept of making the .htaccess file with the code:
redirect 301 "/old/old.htm" http://www.you.com/new.html
However will this redirect every page of the old site? or just an individual page. How do I achieve redirection with the entire site?
I have a rewrite in .htaccess (apache rewrite mod enabled), all pages from old site
http://www.old.com and
http://www.old.com/site/index.php? .... redirect to the new site
http://www.new.com or
http://www.new.com/website/index.php?... (notice that /site/ and /website/ are different names)
pages from the old site
https://www.old.com (notice the s on https://) get redirected fine but pages from
https://www.old.com/site/index.php?... do not, they get a 404 error
since the old site is not secure anymore neither the
https://www.old.com or
https://www.old.com/site/index.php?... really exist anymore but
https://www.old.com gets redirected and the ones with
/site/index.php?... added do not get redirected but go instead to a 404 error
Be careful with a 301, 301 redirect is used for where content has moved.
e.g. content about making a cake was here /makeacake.html now is /cakes/making-a-cake.html.
what I would recommend is find the pages where the majority of your uses come to, and redirect those pages to the new relevant pages / sections and just delete the rest and add a custom 404 error page. which tells them the old content has been moved.
You can also use goggle web masters to remove pages from there index.
Assuming the old pages don't exist any more (would throw 404-errors), you can do the following: You redirect all the pages that don't exist anymore to the start page. (As specified in the comments below.)
This is the updated .htaccess code you can use to make that happen. The first RewriteCond checks if the requested path is a file, the second checks if its a directory. After that, you get redirected to the startpage - or any other page for that matter.
http://www.example.com/i/am/an/old/page.html or http://www.example.com/i/am/a/different/old/page.html will all redirect to http://www.example.com/
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . / [R=301,L]
The best way to redirect the entire site is by doing domain forwarding through your web server (or web host... most have the option in their control panel).
Domain forwarding is much more efficient than sending 301 redirects back to the client.
Am I right in thinking that your site is on the same domain name but you've changed it structurally?
So, you have a load of old page URLs that have now changed to new URLs (but on the same domain).
For example, you may have had:
www.yourdomain.com/about-us/history.htm
that has now become
www.yourdomain.com/our-history.htm
If that is the case you will more than likely need to set up many 301 redirect rules. It doesn't necessarily mean that you have to set up one rule for every single page change as you can use RegEx to catch pattern changes in the URL structure. As a scale example, I recently set up a htaccess file of 301 redirects for a site with just under 600 changed URLs. There were 70-something 301 Redirect rules in the end.
It's not necessarily a small job but it is doable. Worth it to retain your SEO rankings.

Why won't jQTouch work on my localhost?

I was trying out the jQTouch demos on my localhost. I couldn't get any response after clicking on "Submit". I Googled the problem and only found this link text but it doesn't work.
Just remember to add the ajax file(such as ajax_post.php) in the .htaccess file. Cheers!
RewriteCond $1 !^(index\.php|javascript|**ajax_post\.php**|robots\.txt|captcha)
The same-origin policy prevents localhost AJAX requests since the domains of the request and the response are different. To workaround this, use the IP Address, disable the policy, or add the Access-Control-Allow-Origin: * header to the response.