How do I make a webapp that doesn't have "global" pages? - javascript

this might be a really simple question but I couldn't find an answer out there on the internet.
I'm not sure how exactly to word this question because I don't know the terminology, so I will give some examples to demonstrate what I am talking about.
I am trying to make a web app that involves two users, user 1 and user 2. User 1 will answer a certain number of questions and user 2 will do the same (possibly concurrently), then they will both be shown which questions they answered identically. My problem is: how do I show the users the questions locally in a manner that if user 2 goes to the webapp at the same time user 1 is using it, the server won't show them the same page/question?
I basically want the web app to be like a shopping web app (like the Walgreens one for example) in the way that each user using it sees something different and not the same HTML page that everyone else would (as would be the case with the Walgreens homepage). How would I go about accomplishing this?
I am sorry for how vague this question is, I just completed this tutorial and realized that I was quickly running into the problem detailed above and have never independently made a web app before. Any help is appreciated!
EDIT: I am looking for a more generalized/conceptual answer to how to solve this problem, I would never expect someone to actually code this out for me.

I would use socket information in node js side to construct the page based on the user that ask the resource. :)

Related

Need help on Converse.js

Am trying to create a chat application using Converse.js. As a student am trying to figure out where to start from in order to edit the code to suit my application. i can not figure out things like the entry point of the application.javascript. i need pointers. Looking for step by step video on youtube yields nothing meaningful for me, i can not find anything meaning full. The online documentation i think its for advanced users. Am looking for some sort of baby steps. what i want is able to edit the source code without a hustle
I tried running it on my localhost and and connecting. Wat am concerned about is editing the source code

Should I be worried about the user's possibilities to tamper code while inspecting the website? [duplicate]

This question already has an answer here:
Security modifing app state from javascript
(1 answer)
Closed 4 years ago.
I am a self-taught web developer and I've learned a lot throughout the years from more experienced developers, but there is one thing that is always bugging me...
The idea that any user can see and edit anything created using "front-end technologies", i.e. HTML, CSS, JavaScript.
I feel I am too paranoid about this, but wanted to hear from people that are more experienced and skilled than I am.
Obviously, I know I should secure the website so that all the imaginable actions from the user can be proofed, but I still can't help but wonder, is it enough?
I understand this is a general question and it's hard to answer, but consider the next situation.
I am building a website with substantial number of modals, or pop-ups.
An example would be a log in modal.
When a user clicks on the "log in" button, I display the log in modal and hide it once it is closed.
Now consider multiple of these modals being hidden from the user, but they still appear as hidden elements when the website is inspected.
A user could then display the modals while editing CSS which would cause issues if these modals are displayed where they shouldn't be displayed.
This is a crude example, but is this considered "bad practice/code structure"?
I am just very confused if this is completely insignificant since it isn't the "normal" functionality of the website, or if this is important and I should carefully structure what is shown in the inspection window of the browser.
Hopefully someone will shed some light on this issue.
Thank you
As long as the code visible to the user doesn't contain anything that should be secret and known only to the server, it's definitely not something to bother with. There are an uncountable number of ways for anyone to break a website by opening the console or developer tools and by deleting/moving elements or typing in Javascript of their own. Making a website impenetrable to this sort of tweaking would be impossible.
If the website breaks as a result of a user's own tampering, that's on them, not the site designer (and, worst case, they can just refresh the page to get back to the working-as-designed page). As long as nothing meant to be secret is sent to the client, feel free to build pages with the assumption that the end user will not run any custom Javascript or make any changes on their own. They may do so, of course, but as long as it doesn't allow them to do things that cause problems for other users or the server (like accepting unverified input on the backend, or sending something that should be secret to the client), it shouldn't be something to worry about.

How do I code a dynamic website? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Never mind. I've found the correct answer
I think you have already all pieces in front of you, but don't know where to start.
I suggest that you
find an exciting Bootstrap blog template (like the free ones at Start Bootstrap)
understand the code, which is usually a good mixture of HTML5, CSS3, JavaScript with a modest use of jQuery
tweak it with your own ideas
if you have some special needs not covered by the template (for example collapsible menu items), you can browse the Bootply Snippet Library to look how others coded it.
Nowadays no web programmer starts from scratch. They choose a template with the basic structure of a one-pager, multi-pager, blog, e-commerce, etc. and start from there.
By the way: Alaboudi mentioned in his answer that you need to learn MySQL, too. This is indeed needed for dynamic content like e-commerce and blogs, but not for static content like business websites that don't change that often, but put an emphasis on individual page layouts.
But to get your first website up fast I would start with static websites and later extend your knowledge to MySQL.
Everything you have learnt is great, but you must also learn a database querying language (SQL). May I suggest you start learning MySQL, its very friendly for beginners. Now let me give you an example of how to code a dynamic website.
Lets consider facebook profile pages as an example. Firstly you must realize that there isnt 1 billion uniquely saved profile pages made for each user on the server. Rather, there is only 1 html css template that is filled in with appropriate information depending on the person loading the page. When the visitor comes to his profile page, his information must be queried from the database using a backend language (PHP in your case). Once the result of the call is retrieved, you fill in the appropriate information in your html (name, age, friends, blah, blah) and send it over to the user. So technically you are constructing the complete page with every call and you never actually have the complete page saved on the server.
Long story short, you should look into using a database.
This is not really a question. I would suggest you to go and code something.
You want to do a blog? Ok, try to do it with what you've learned so far.
When you'll start to build it, you'll have specific questions on specific problems, you can then search on Google your specific problem or come back to StackOverflow and ask for it.
Any resource is good and lucky you, there are plenty of resources on the internet ;)

How to allow users to build a custom order or quote

I'm working on a site where I need to allow users to build a custom quote and then submit this quote. The end result could be as simple as an email to the site owner detailing what options the customer selected. Essentially it needs to work in a similar way an e-commerce system but without the checkout stage.
The user will select one of three plans first of all, then choose whether they'd like any add-ons (around 20 add-ons available). Finally they would enter a few of their own details and then click submit. The trouble is I've no idea how to go about building this.
Can anyone point me in the direction of where to start or does anyone know of any existing plugins that can do this type of thing already?
Any help or suggestions are appreciated.
Tom
As others have said this post is a little open-ended, and not really ideal for Stack overflow.
That said, to point you in a direction (not necessarily the right one), you seem to be talking about building a form and submitting the results somehow. There are countless ways of doing this but a good place to start would be PHP - this would allow you to build forms and store the results.
Not a great answer I know but if you provide some more details I'd be happy to try and elaborate.

Access to global JS variables without owning the page

overflow community,
I've read several posts trying to solve the problem, but they dont answer my question.
Is there any legal way to find out what events (?) another site sends?
I dont ask because of illigal buissness and i am ready to find out more myself as soon as i know what i realy have to look for in terms of topic and methods.
In particular its about advertising and finding out if someone registered on another via a referal link. Like a sign that is sent as soon as the registration (on the other site which is not mine) is completed.
I want to find this out during the visit of the client on my site.
I just need to know if such a thing is legally possible and what JS topics i should give a go to find out more.
I hope my post is comprehensible enough. :)
edit: It's not about global variables.
You can use your browser's developer tools to see what's happening behind your back while you're visiting a web page (I recommend Firebug in Firefox). Alternatively, you may use a network spoofer like Wireshark to capture the traffic from the browser and analyze it in any way.
It's all up to you to find the information you think is relevant inside it in URLs, in request headers and bodies, etc. In your case, this would include script generated content and referal codes that may help keeping track of a user's browsing history across domains.
You don't really need Javascript knowledge to do this, but you need some basics about networking protocols.
This is probably as illegal as using a text editor, but just ask your lawyer if you're unsure :D

Categories

Resources