0

I am using the facebook business extension and have the following bit of code in my FBE integration::-

initFaeClient() {
    // Handling the case for closing all open FAE client as suggested in DOC
    if (this.clientWindow) { this.clientWindow.close() }

    this.clientWindow =
      window.open(this.fetchClientUrl(), this.clientWindowName, utill.setWindowOptions())
}

Basically this.fetchClientUrl() is going to return the following :

http://www.facebook.com/ads/dia?origin=http%3A%2F%2Fmytestsite.test

The problem is when this code runs from a mobile device and hits the above url , facebook does ( I believe ) a 301 redirect and then the url changes to:-

http://m.facebook.com/ads/dia?origin=http%3A%2F%2Fmyshopmatic.test

I don't wont this to happen , is there any way i can prevent facebooks 301 redirect ? the FBE api does't work with the m.facebook.com url and i've spoken to a facebook rep about this, so how do i prevent this redirect ? anything i can pass inside the window.open method ?

Alexander Solonik
  • 9,838
  • 18
  • 76
  • 174
  • You could try if the method mentioned here still works, https://stackoverflow.com/a/10019373/10955263 - but that is very old. Don’t know if there’s any more current replacement. – 04FS Feb 03 '20 at 12:02
  • @04FS , this solution no longer works unfortunatly :( – Alexander Solonik Feb 03 '20 at 13:58
  • I don’t know if there is any current replacement for that parameter. If not, then there’s little you can do about this in the first place - Facebook decides when to redirect, probably based on stuff such as the User-Agent request header. – 04FS Feb 03 '20 at 14:04
  • Why do you want to prevent a 301? – WizKid Feb 03 '20 at 17:55
  • @WizKid because facebooks API does't work for `m.facebook.com`, in my instance `http://www.facebook.com/ads/dia?origin=http%3A%2F%2Fmytestsite.test` works , but `http://m.facebook.com/ads/dia?origin=http%3A%2F%2Fmytestsite.test` will not work. – Alexander Solonik Feb 04 '20 at 05:31

0 Answers0