WordPress Language Page - javascript

I've installed WordPress and played with it for a while. And I got a question how I can make a top page which let visitors to choose their languages.
Let's say there ware two languages for a website, English and Japanese. When a visitor opens the domain root(http://example.com), a selection page appears. If English is clicked, it redirects to the page "http://example.com/en", which has been created by WordPress's page feature(permalink). If it is Japanese, it goes to example(dot)com/jp."

This kind of page is annoying and most of the time useless. As you can automatically detect user browser language and/or ip location, or display a language switcher anywhere in your website.
If you need it anyway, you can try WPML plugin (or other free alternative, if you find one...).
Then you can easily test if you have a detected language and if there is not, display your language chooser.

Related

Display an iframe when hover certain content in a website

My team is developing a widget/sdk so people can embeed our code in their sites and display some useful things.
My question is:
once these owners embeed our code, is there a way for us to target certain content in their website?
We want to, for example, if the content in such sites include a hashtag with a word (say #stackoverflow), when the final user hovers that hashtag display an extra iframe on top of it, like a tooltip in the top of the word.
Is this doable?
We thought about creating a chrome extension so any the final user can have that functionality, but we're also wondering if that is doable when the 3rd party site embeeds our code too.
Thanks!
edit: just to clarify, the owner of the site has to embeed a .js file in their site to display our iframe.

JavaScript scripts stop working when page changes the language

I have a WordPress website with Elementor and a language translator installed. A script for getting the price of Ethereum (every second) is located in the block with the HTML code of this element. There are two languages that set on the website - English, and Israel. The point is when I change the language to Israel the page mirrors horizontally. After that, all the scripts on the page stop working.
Please help me. Thanks.

JavaScript enabling on browser when a button is clicked (not automatically)

I use a lot of JavaScript on my site (currently under construction). My worry is if some of the client side's system has JavaScript disabled then my site will "miserably fail".
I know that we cannot programatically override to enable JavaScript as it would be a security issue. But what I want is if the client side system has JavaScript disabled then a popup should appear with a button so that when the user clicks the button automatically JS will be enabled no matter in what browser he is viewing the site.
I am asking this because I saw the same thing myself when I viewed some other site.
That is not possible. You can however display instructions on the page on how to enable JavaScript, but considering that people who disable JavaScript usually know what they are doing they'll know how to enable it themselves.
I'd say there are very few people who accidentally disable JavaScript, so your worries are probably unnecessary.
Well if you want a popup to appear then you need to make it happen using javascript, so I guess the answer is that you can just ignore the very small percentage of people who have javascript disabled for their browsers.
What you are probably looking for is Progressive enhancement.
Instead of showing a message through JavaScript that tells the user to enable JavaScript you do it the other way around.
By default you show a message, in a div for example, and when JavaScript is enabled you hide the div. You only use JavaScript to enhance the user experience but offer a 'reasonable' experience when the user doesn't have JavaScript enabled. Reasonable could mean in your case an empty page with some text that explains why you really need JavaScript.

Do links with javascript slow down a page?

Due to an issue that came up with a website I have to use javascript for all of the links on the page.
like so...
<img src="image.png"/>
Will having many links with javascript on the webpage slow it down significantly?
Does the Javascript run when the page initially loads or only when a link is clicked?
EDIT: For those asking why I'm doing this. I'm creating an iPad site, when you use the 'add to home page' button to add the site as an icon, it allows users to view the site with no address bar.
However everytime a link is clicked it reopens Safari in a new window with the address bar back.
The only solution I could find was using javascript instead of an html based link to open the page.
For further reference see...
iPad WebApp Full Screen in Safari
2nd answer
"It only opens the first (bookmarked) page full screen. Any next page will be opened WITH the address bar visible again. Whatever meta tag you put into your page header..."
3rd answer down
"If you want to stay in a browser without launching a new window use this HTML code:
a href="javascript:this.location = 'index.php?page=1'"
"
I can see this adding to the bandwidth needs of a site marginally (very marginally), but the render time and the response time on clicking shouldn't be noticeable.
If it is a large concern I would recommend benchmarking the two different approaches to compare the real impact.
What do you mean by slow it down?
Page load time? Depends on the number of links on your page. It would have to be a LOT to be noticeable. Execution time? Again, not noticeable.
The better question to ask is are you o.k. with effectively deleting your website for those without javascript?
Also, if you are worried about SEO, you will need to take additional measures to ensure your site can still be indexed. (I doubt Google follows those kinds of URLs... could be wrong I guess).
EDIT: Now that you explained your situation above, you could easily just "hide" the address bar. See this SO question.

Is an overlay more susceptible to phishing?

Working on a web development project, functionality requires a user to navigate through the website then login and perform a very sensitive function. The login and subsequent functionality is hosted on a different site (sorry I can'be be more specific due to sensitivity)
Choices considered for the UI are:
A javascript overlay
A popup
Load in the full page
The current development and prototype user testing has been on an overlay with no problems. There is concern that an overlay does not show the address bar and the SSL certificate therefore is more susceptible to phishing.
A popup or a full page would be better in this respect but I have read studies that show users do not pay attention to passive indicators:
http://www.usablesecurity.org/emperor/
Popups also have the problem with popup blockers, the overlay looks the best and provides the least disruptive user experience, i.e. user feels they have not left the original site
So what is the best option considering security, usability and design?
Related question: is there any problems with loading an iframe within an overlay? e.g. scrollbars etc?
Edit: The question is more how to present the secure login page on an overlay, a popup or redirect to load the login in the full page. I'll edit the question to make this clear
Edit: Any links to research or studies showing increased phishing if an overlay is used would be very useful for making the case
Just redirect the user to login on the secure login page and customize its look. Make sure the secure login pages url are the same every time. You might wanna have a look at how Stack Overflow (a big website for programmers) handle logins with OpenIDs.

Categories