Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Being comfortable with Javascript, HTML5, and CSS3, allows me to achieve most anything I want to accomplish in a given design, however removing Javascript from the equation leaves little to offer in terms of dynamic content. Being that some users prefer to disable JavaScript, albeit this is exception rather than the norm, in such use cases, are there any alternative technologies that would (could) not be disabled, and thus allow for workaround-dynamic content to still be present in the absence of Javascript?
In order to satisfy these requirements the following criteria would have to be met:
(1) The technology has cross-browser compatibility with (nearly) all modern browsers.
(2) The technology would need to allow for user input on the website (such as text fields), which would then be sent sever-side for processing, then return data (such as a chunk of HTML).
(3) Then, this technology would also need to be able to take this chunk of HTML/data and add it to the page without a refresh (ideally, though a refresh my be able to be tolerated if necessary).
Doing my own due diligence, I have come up with part of an answer, though I am not sure about the feasibility of my approach, and thus would like to hear what you think about using server-sided scripting (like PHP) and HTTP-META-REFRESH, to achieve such a result.
Does such an approach sound feasible, or is PHP-scripting on the server side also have the ability to (going out on a limb here) be turned off by the user as well? If it can be turned off, furthermore, are there any other ways to send and receive data that can't be (or has a much less likelihood of being) turned off, then use this data to change the HTML of a given page similar to the way the "document.getElementById(id).innerHTML = new HTML" approach?
Server-side languages like PHP cannot be "turned off" by the user.
Using "http-meta-refresh" is not relevant. You cannot use that to simulate in any way the interactivity of JavaScript. It might meet point 1 (browser availability) but it has nothing to do with points 2 and 3.
Specifically, it cannot be used to issue POST requests (point 2) and doing a meta refresh refreshes the page. It misses point 3 entirely.
There is no way of achieving JavaScript-like functionality such that it cannot be turned off and works in all browsers. There is nothing remotely like this.
Related
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 6 years ago.
Improve this question
I'm attempting to create a web page that takes user inputs from form fields and outputs various calculations as values displayed on the same web page. In addition to this, the user inputs create a "Gun" class instance and set its fields. Another class's method within the project generates random x and y coordinates based specific fields from the Gun instance. These coordinates are meant to be used in a Swing class, perhaps fillOval, to draw circles (which represent bullets) over an image embedded in the page. This is essentially a shot simulator.
Can this be done? Can a JFrame be embeded in a web page? Or am I wasting my time? Is there a more efficient language for this than Java?
Can a JFrame be embeded in a web page?
No, at least not directly, but an Applet can be embedded. Since you ask specifically about Swing, you can use a JApplet, which is an Applet that serves as a top-level Swing container, analogous to a JFrame.
As #ElliottFrisch warned, however, applets are a somewhat dated technology. The biggest problem with them from my perspective is that many browsers do not support them -- either because no JRE is installed on the client machine, or because Java support is not enabled in the browser. The latter is quite common these days, even on machines with a JRE, partially as a result of a series of unfortunate Java vulnerabilities.
Can a JFrame be embeded in a web page?
The short answer is yes, with an Applet. However, applets are an older technology and I would suggest you look into more modern web based approaches.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
There are many ways to use JavaScript. When I use JavaScript with an anchor, I write code like this and I think this way is right.
Method One
But my co-worker uses JS like this.
Method Two
Is there a coding standard or are both methods correct?
DISCLAIMER: Inline JavaScript is, generally speaking, a bad idea, and 99% of the time you're much better off separating concerns, and using a library, such as jQuery, or whatever similar toolset that your framework of choice recommends.
Nonetheless, to answer your question, if you must use inline JavaScript, I recommend that you omit the "JavaScript:" keyword. It specifies a "pseudo-protocol," and is not necessary for modern browsers to interpret the code. It is a relic from the last decade, and there is a bug with some versions of IE:
"There is one (somewhat obscure) bug with the javascript protocol - in
Internet Explorer*, it will think you are leaving the page when you
click the link. If you are using window.onbeforeunload, then your
navigate-away message will appear at this time. For this reason alone,
we've stopped using the javascript protocol completely so we don't
have this bug show up because we forgot to check for it when we add a
navigate-away message to some page."
When do I need to specify the JavaScript protocol?
https://bytes.com/topic/javascript/answers/504856-javascript-pseudo-protocol-event-handlers
Both the ways are ok but in first way you should use a external JS file. Otherwise it is ok.
For small tasks and events second ways is good.
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
It is just a noob question: why do browsers have a "disable javascript" function?
I am just curious and hunger for learning. Thanks!
If you're asking why some browsers might have Javascript turned off, it is a user setting in a browser. The user has the ability to decide whether they want to enable Javascript or not.
Users may choose to disable Javascript for either security or privacy reasons. It seems less common these days because more and more sites are not fully functional without Javascript enabled.
In my opinion, one reason could be some highly technical users may want full control over how they want their browsers to behave. Javascript is one part of browser behavior which some users may wish to control. Thus - it is a question of choice. Sometimes - some Javascript could be too annoying for some choosy techie users and they may wish to turn it off.
Thus - in addition to security and privacy, it is a choice that browsers offer to end users. However it is true that nowadays most sites hardly function without JS. But still there could be those plain old vanilla HTML sites around that may do without any client side scripting.
Regards
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 8 years ago.
Improve this question
Hi I have developed a site,but now i required to add a language translator in my site. how to add a language translator to translate all content of my site to a desired language dynamically.help me to solve this
You should not use any translators that do this operation on fly. Remember that translators are your enemy when translating more than one word. Especially when both languages are not english. Secondly this could take many processing resources and without caching it, it will blow up your network.
To do it right, you should apply i18n feature to your site. This will require from you:
replace any labels on your site with i18n tags with i18n keys
create i18n property fields holding translations for each i18 key
change of language will require page reload
when displaying content (taken from database or the source), you should create content per language, and select it basing on Locale from Request
As you can see, creating fully multi-language app is not a walk in the park, it is hard work.
If you want to provide your website content in different languages, you will need a localisation service (depending on the size/scale of your site) or use an API such as Google Translate's API, which is not free. See Beri's answer on performance implications.
You need to do a bit of research yourself and see which solution suits your needs. We don't have much context on your site, so it's a bit difficult to answer.
This answer may be relevant to you.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm using HTML5, CSS3, and other new technologies.
I want to prevent my users from using old browsers in a standard way.
How to detect old browsers in javascript or PHP?
How to show alert users properly?
This website provides a easy to use script that helps your users in a nice way to upgrade their browsers:
http://www.browser-update.org/
Include our small javascript notification on your website
Visitors with out-dated browser will be informed by a little, undisturbing bar, that his browser is not up-to-date and it is
recommended to update.
By clicking the bar, he will get to an info page with arguments why to change/update and some browser choices.
If the visitor ignores the advice, it won't appear again for some time.
It won't prevent the users from using your website, it will just notify them that they have an outdated browser and try to encourage them to update, and it does so in a discreet way.
By default, the script will give this message for a recommended set of old browsers (that automatically gets updated over time when browsers become too old), but you can also manually choose for which browsers the message will appear.
You're also able to customize the looks of the message.
Rather than diminishing peoples browsing experience by blocking them, consider progressive enhancement instead. While it may take a little more work it will be worth it. And as already suggested take a look at modernizr