WordPress Post/Page - how to detect the screen resolution used by a website user?

Hi Experts,

I have some videos on my website that will only be clear if viewed at a screen resolution 1280 x720 px or higher.

Is there a plugin that will let me give the user a warning if his/her screen resolution is less than that?

Regards,
Leigh
LVL 1
LeighWardleAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
There is 'standard' javascript that can check the screen size.  You can see it in the "View Source" on this page: http://www.dibsplace.com/jscr.html  Just copy whatever you want from that page.  I copied it from somewhere else.
Mandeep SinghDatabase AdministratorCommented:
Hi,

Check this out: http://www.javascriptkit.com/howto/newtech3.shtml
http://www.javascripter.net/faq/screensi.htm

They uses JavaScript code, that you can use in your header.php file.
LeighWardleAuthor Commented:
Thanks, Dave & Mandeep,

The problem I have now is that WordPress is filtering out my JavaScript.
What's the easiest way to include JavaScript on selected posts/pages?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Dave BaldwinFixer of ProblemsCommented:
I don't know.  I don't use Wordpress.  Maybe Jason will see your question.  He is most likely to know.
F PCommented:
I find the easiest way is to do this with an element on the page you want to load something:

if($('#yourElement').length > 0)
{
    // it exists now do something that only appears on a page where it does.
}
LeighWardleAuthor Commented:
Hi Frank,

Thanks for your suggstion.
But my immediate problem is that the WordPress Editor will not save any code that I enter.

Here are before and after screendumps (when I click the Update button, the Text window comes back blank).

Before
After clicking Update
F PCommented:
Nooo, sorry. You input your code like that in the footer.php file Page Template outside of the page where you're trying to add it. See here:

https://codex.wordpress.org/Page_Templates

You can also try this extension:

https://wordpress.org/plugins/genesis-simple-hooks/

... basically you need to edit a template file though. Hopefully that clarifies!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WordPress

From novice to tech pro — start learning today.