Search code examples
javascriptiosnsurlsession

iOS - free hosting in byet.host lie the javascript protection in app with NSURLSession


I'm using free hosting at byet.host because they have free SSL which I'm using it to send remote notifications, but I can't reach .php files with NSURLSession it returns me "This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support". My question is: Is there I way to open url with NSURLSession or other method and lie the hosting that my app has javascript ?


Solution

  • The hosting provider doesn't know or care whether the client has JavaScript or not. What's happening here is that the hosting provider is serving a page that requires JavaScript for some reason, instead of the content that you're expecting (from your PHP script). I would suggest dumping out the returned HTML blob to a file and opening it in a web browser to see what it actually is serving, because that might give you some idea of why things aren't working.

    There's almost certainly no way to work around a hosting provider that serves the wrong data. They're either running your PHP script and serving the contents or they aren't. Chances are, something is misconfigured in CPanel or something.

    I mean, I suppose the hosting provider could be doing something weird like restricting the site content to specific user agents, or blocking others (e.g. curl), but beyond that, no, you can't "fake" JavaScript, and even if you could, that wouldn't solve the fact that your server is not serving what you're expecting. Having JavaScript won't fix that.