Make image a button to trigger code?

I have some code that will check a users screen resolution and open a new window with a particular version of my website in, I have several sites for different page sizes. But when this code runs in Safari the pop-up is blocked so I would like the image on my page to be a button that runs the code to open the ‘correct’ window (based on the screen res) and as a button is launching the new window Safari should be okay about it.

Unless I am doing something wrong?

http://www.meta.projectmio.com/pop.html

But how do I modify the code to do this, I’m hopeless?

Thanks.

I have Firefox set up so that popups open in the current window. So in that respect, your intentions would be wasted and the site may not work for me. As a user, the site not working due to something that silly would annoy me enough to make me leave.

You should ask yourself if this is absolutely necessary (I can think of no cases where it would be). Popups are a bad idea in themselves, and dangerous to depend on, as you don’t know how draconian a pop-up blocker a user may have.

Finally, delivering different websites for different screen sizes belongs in the early 1990s. You should deliver a website that is flexible and silently adapts itself to whatever screen size is used.

By changing the script to make the portion of code that searches for the screen dimensions and to load the correct window a function, it now transpires that the new window will now not automatically load itself upon load, the picture (which calls that function) will kick start that part of the script instead.

I need the code to run automatically, only requiring intervention from the user (by clicking on the image) if in the case of Safari, were it blocks popups.

I am unsure if the code even does what I think it does, that is to load different pages for different screen resolutions. I can’t test for that.

Can you help please.

Yes, the code you have does load different pages for different resolutions. I am advising you against doing this (read my previous post). Can you explain why you need to do this? It is a very bad idea.

Because, and I know what your thinking, the main site (www.meta.projectmio.com) relies on the screen being a certain size, of which I only noticed near the end of a lot of very hard coding for me (I cannot code, I made everything work through a lot of persistance!) and then I realised proofing it in Safari was different to FireFox, and then this and that (even colour codes threw up problems).

But essentially if you go to the main site, you’ll notice that the script drops to a certain point (which on my 13.1" MacBook (with dock icons sets to 128x128)) is the bottom of the webpage (in FireFox, and this is for a FireFox extension, issues like safari not having a status bar are just that, and issue). I needed to tightly control the page size, I think that a popup window with no menu is best (although FireFox forces a url bar, others don’t).

I put a lot of effort into my page and the other sites are:

http://www.meta.projectmio.com/640.html
http://www.meta.projectmio.com/800.html

run these in their respective resolutions and you’ll see they’re not too bad, they’ve all stayed true to the theme and I’m really proud of them but they have to load at the right size, which is the full size of the screen, but they have to or the experience is lost.

This is why. And the funny thing is nobody will ever use those two other sites, but maybe. (I have language translations too!)

Reason enough?

Thanks.

they have to load at the right size, which is the full size of the screen, but they have to or the experience is lost.
That’s the point I’m trying to make - you can’t force the user into doing something. The user has the browser window at whatever size they are most comfortable at. Not everyone has it maximised all the time, for instance. Producing a different size may be what you the designer likes, but I guarantee it’ll bother a lot of your visitors.

the main site (www.meta.projectmio.com) relies on the screen being a certain size
This is not true. It works at lots of different sizes. I tried by resizing my browser window to many different sizes. That’s the point - it has to work at all possible sizes and even if the window is resized, not just at a bunch of “resolutions”.

I can see you’ve put a lot of effort into this site. Frankly, the eye-candy is lost on me, particularly as the site is about a Firefox extension. The curvy drawings look more like they’d belong to a website for an artist or something of the sort. Not everyone will figure out that to see the content, you have to click on the curved thing at the bottom of the screen.

And what’s up with the Java applets? The big thing shaped like a thumb-tack isn’t even animated! And as for your HTML, I’m not going out of my way to be horrible, but it is absolutely riddled with errors (113) and awful practice. Examples:

  • the <meta> tag can only be inside the <head>
  • a <p> should only contain text and images
  • to make vertical space, you do not need some white text and line breaks (<br>) - you need margins in CSS!
  • the <table> element is only to be used to put information as a table, not for putting things in place in your layout

I cannot be clearer in saying that you are going about this very wrongly. You don’t need separate pages for different screen sizes. You only need one, and you need to use good HTML and a sprinkling of CSS to ensure it adapts to all possible screen sizes. I think you’re trying to do too much with not enough knowledge of designing web pages. At the moment it seems like a huge mish-mash of things that you probably don’t understand all too well. You really should try to learn how to write good HTML first, and then the basics of CSS. It will be well worth it in the long run.

Come on, your telling me that somebody with 640x480 screen is going to be multitasking with viewable panes? No way, they’ll have the whole window used for each application and alt+tab, as for 800 I should think the same thing too… after all if they’re still using resolutions like that then they’re in the dark ages and they’ll be used to being pushed around. As tragic as that may sound.

I’m glad not everybody will be able to figure my site out, have you seen the supermarket like web we have today where everything is the same looking and obvious and boring and social etc… banal is the word in many a case, no matter how simplistic and clean. I am an artist and this is my site.

The Java applet does work! Its a concious decision I made, that was to go with Processing (an open sourced version of Flash) which, when compiled, exports into a Java applet. It does work I’ve tried it on loads of computers.

I’m going to get a programmer to tidy it all up some day, I know its a mess but that’s what its always like behind the scenes for an artist, I just don’t have the money to get a professional to do it and getting this done myself and big achievement. I’m not without appreciation, but front window wise (and it does work, all of it), it works.

Look I’ve been doing this project for ages and the countless amount of times I’ve come across people saying just what you have and not given me what I want is not worth looking into. Did I listen? No! and have I gotten what I wanted? Yes! The world is full of people who say you can’t do this and you can’t do that, I don’t mind, but I will get what I want.

If you can’t help me or are not willing then I’ll move on but rest assured no matter how much time, effort or patience I will get what I want.

Thanks.

You’re still missing the point. The point is that your website will look identical in different screens if you do it properly (and doing it properly is a trivial effort - the route you’re taking takes loads and loads more effort and time), and therefore you don’t need different pages delivered for different screen sizes! By the way, the way you currently have it, you’re measuring the screen size, not the browser window size, so the measurement you’re using is wrong to start with.

I’m glad not everybody will be able to figure my site out, have you seen the supermarket like web we have today where everything is the same looking and obvious and boring and social etc… banal is the word in many a case, no matter how simplistic and clean. I am an artist and this is my site.

Fair enough. Just bear in mind that besides being pretty and cool, it needs to be usable and accessible.

You claim the Java applet “works”. Let me tell you in what ways it doesn’t work:

  • It takes a long time to load (all Java applets do). While it does so, I am presented with a grey box.
  • Nothing happens if you right click it. This is disconcerting for many users, me included, especially as it isn’t clear it’s a java applet (looks like an image).
  • There is no need for it! All it looks like is a dish with a line under it, and it doesn’t do anything. So you could just use a plain old image.
  • Your flashbox (the semi-opaque background) interacts badly with it
  • Not everyone has the Java plug-in. They’ll be presented with an irritating message explaining they “need” the java plug-in. If someone goes to install it and realises what a waste of time it was (as all they get is a dish with a line under it), they’ll be annoyed.

Did I listen? No! and have I gotten what I wanted? Yes! The world is full of people who say you can’t do this and you can’t do that, I don’t mind, but I will get what I want.

This explains how you’ve got yourself into this mess.

If you can’t help me or are not willing then I’ll move on but rest assured no matter how much time, effort or patience I will get what I want.

I’m sure you’ll eventually get what you want, but the cost (in time and effort) will be huge.

No it will not be identical, the idea was to have no scroll bars, hence the idea of using a system that delivery webpage within the webpage in view. To scroll left/right, up or down once, to explore the whole screen space given was the idea. The text alone had to be managed and in some cases slightly preened.

The Java applet does work, it requires a mouse to be over it before it does anything, then it comes to life. Then click something obvious when you see it. Patience. Also the uer is immediately presented with a percentage bar when it is loading.

This conversation is going nowhere, you shouldn’t have commented and I shouldn’t have entertained you. I will get the site no matter the efforts or cost.

And that’s a sure fire way of getting support. I wonder why you even bothered asking, if you refuse to take expert advice?

No it will not be identical, the idea was to have no scroll bars, hence the idea of using a system that delivery webpage within the webpage in view. To scroll left/right, up or down once, to explore the whole screen space given was the idea.

How do you know it won’t be identical if you don’t try it? I’m telling you it can be identical because I know CSS can do it so the site is identical in all screen sizes and without scrollbars. Your knowledge of CSS is clearly very poor, so why you’re so convinced you’re right is bewildering.

Regarding your Java applet, yes, there is a progress bar, but after it gets to 100%, the drawing-pin shaped thing takes a fair while to appear and during that time all I see is a grey box (it seems some ytimg.com images are being downloaded). Hovering over the drawing pin and clicking it does nothing as well.

I agree with bemmott’s post… why bother asking at all if you already think you’re right?

Here’s the answer to all your questions (and I’ll not be visiting back to this thread after this so you may say what you like), read my first post and see if any of your responses have been useful to it?

None are so blind as those who will not see
:frowning:

Raffles has provided the exact answer that blinm needs but not the one blinm wants. So the end result will either be that blinm finally realises that what they want is garbage and that what they need has been properly described by Raffles OR more likely they’ll just proceed with producing the garbage and will then wonder why no one visits the site.