Website functionality automatically start and stop working - javascript

Recently I got a project where I had to make some changes in a Wordpress website with some customized theme (Besocial + BBpress) and custom coding. Now, I have almost done all changes but there is a strange bug/error where login and register functionality sometimes work as intended and sometimes it doesn't. Also, after login, user has to be redirected to a News Feed (much like Facebook) but that too sometimes work and sometimes doesn't. I am not being able to find what is the error or bug. Can you please suggest something to make my process easier? The project is already delayed for 2 weeks.
Thanks, any help appreciated :)

a)open website in private window, see if issue is still their, if not than delete browser cookies.
b)Deactivate plugins and check the issue.
c)Check by changing the theme.
d)Reset Permalinks
e)check your .htaccess
By doing these thing you will know from where issue is coming.

Related

What am I doing wrong with Angular js manual bootstrap process?

I am using Angular 1.7.2 in a project i'm working on. (I prefer Angular 1.x)
I am doing the bootstrap process manually (because i'm adding scripts programmatically).
But, I am having 2 issues with the manual bootstrap process.
I have to use a setTimeout, else the bootstrap never works. And my problem with this is, the more files I add to my project, the longer i have to make the timeout.
Sometimes when I load my web page or refresh the site, not all my components are loaded. If i monitor the network traffic, i can sometimes see that the html files are not retrieved at all. And there are no errors in the console or anything.
It seems to me there must be something happening in the angular.boostrap process that is failing or getting stuck, but i can't figure it out.
For my first issue, why is the setTimeout required, is there a way to not need this?
Second, why does my site not load sometimes?
Could it be related to the OS locking the files temporarily because of all the source control, anti-virus, other services running on my computer? If so, how can i tell?
I put together a test project with relevant code here on github
I previously thought this was related to the routing, but it's not (see here), But it seems not related to angular-routing after all.
Any information would be much appreciated, this is driving me mad.
Update 1:
I have the code running here on github pages.
Best chance to replicate issue is to use google chrome, enter url, open dev tools (f12), then actually load url. Sometimes, the page doesn't load completely.
I have updated the test website to better reflect my project where I add scripts dynamically.
I think i found the solution thanks to a comment by igor
I moved my app.route.js file to be loaded before any of my angular component and directives and from what I can tell this solves my problem.
I will update the linked sample project too

Showing a javascript app on a page on github.io

I made a simple Openprocessing sketch in javascript using PJ5.js, which can be found here: https://www.openprocessing.org/sketch/522642
However, I want to import some different libraries, which the free version of openProcessing doesn't allow. So my next step was to host the sketch using the free github.io pages.
However, after countless hours of searching, I can't really find a tutorial on how to do this. Anyone has a clue on how to host this javascript sketch on github.io instead of on Openprocessing? Is this even possible?
Thanks in advance! :)
You can host static pages on github and the setup is really simple. Just go to Github pages, scroll down and you will find all the info you need. However you will have to create an html page to run your script. You can't just paste your javascript and run it.

AngularJS hiding #! with rewriting

Lets say we have a website build on AngularJS. We figure out how to hide not pretty /#!/ characters from url by setting HTML5mode on true. But we have a problem when visitor came to the website with old url link including /#!/ i.e. www.example.com/#!/products/ it redirect him to homepage www.example.com which of course we didn't meant we expected to redirect him to www.example.com/products/ so we tried write many rewrite rules which says, that if you go to website through old link with /#!/ than it should redirect you to the new link without /#!/. But this doesn't work for us and we are sure rewrites rules has been OK.
Can be there some problem with AngularJS setting?
Thanks for your time and advices!
Fragment identifiers are never sent to the server, so you can't deal with them using server side code (including rewriting). You have to process them with client side code.
I solved this problem, but I´m not 100% sure how does it work and I would like to know it. All I need to do was add hashPrefix('!') behind setting of html5Mode.
$locationProvider.html5Mode(true).hashPrefix('!');
Now it works as we wanted, but what hashPrefix('!') actually do? I just found from documentation that it "Configure existing providers" but why hiding of #! works without this?
Please can you explain me my last two questions about this topic. Thank you

Multi-page Applications with Meteor/React

I am new to Meteor/React and am trying to figure out how to create a multi-page application. I'm getting really confused about how to actually get routing to work. I want to have multiple html files that, depending on what happens on one, will cause another one to be rendered. For example,
I'm on main.html and I click a button -> and it should then cause secondary.html to render on the screen. I hit another button on secondary.html -> and it directs me to tertiary.html.
However, whenever I launch an application, all my html files just get rendered all at once (something that Meteor just does automatically I guess). I've been trying to work with FlowRouter. Any help or advice would be greatly appreciated!!
I'm getting confortable with iron:router package, you can see the documentation here : https://atmospherejs.com/iron/router
Have a look on what options you can add to this by visiting the documentation...
But still, this is how you implement it the easiest way :
Router.route("/myCustomRoute",function(){
this.render("/myCustomTemplate")
}
By doing this, you will allow your application to have multiples routes :)
However, FlowRouter is a very good option (maybe better) but it will be the same "logic of code" behind :)
Hope it will help !

JS Injection in Wordpress

I just upgraded to WP 4.3.1 on one of my websites. After upgrade (which seemed to go with no problems at all), I noticed that the layout of my pages has changed. There is a bar across the top of my page (not the admin bar) that wasn't there before. When I inspect the element there, I see a whole bunch of new code that is not being created by any of my plugins. And I cannot find the source of this injection in any of the provided php files. I have no idea where it is coming from, but I suspect that something in the WP 4.3.1 package has been compromised, or maybe there is a callout to a site somewhere that injects this code.
Anyway, this is a BIG problem and I don't know how to fix it.
I've copied the injected injected code below. It appears in all the pages on my site, right below the tag. Interestingly it can only be seen by "inspecting element" in the browser; page source does not reveal it (I've added some line breaks to make it more readable, but this is exactly what shows up in my page.
This same problem occurs on every site where I upgrade to WP 4.3.1. I hope someone can fix this problem IMMEDIATELY!!
Clearing cache, history & cookies doesn't resolve the problem. I can't tell where this injected code is coming from. Also, Google doesn't seem to be much help in telling me anything useful about http://kfc.i.illuminationes.com/snitch, which is one of the links that is being created.
Our site was infected, this is what we did to get rid of it
Thanks to this discussion which led me to a more detailed one
Connect via ssh to the server
Check the directory structure and find out recently created / modified directories
Check recently modified files for <script>. I found many files having JavaScript inserted which would connect to external sites.
As these calls were made on each page, I checked header.php in wp-content/themes/your-theme directory. (check the ones you are not using as well as that might be infected but may not show in radar)
You might also want to check footer.php for infection.
Re check file permissions on server as per WordPress Hardening guidelines on Codex
Delete unrequired ftp accounts in FileZilla (or its equivalent)
If you use any caching, delete entire cache.
You can verify if this worked using devtools network tab.

Categories