popup

Workarounds and usability notes.

popup

Postby John Robin Dove » Tue Mar 19, 2019 10:00 am

Hi Clifton,

Using your code I did this:

Code: Select all
function tbfunction_smallPopup(url, alignToName, action)
{
   var bds = { align : '', page : '', screen : '', titlebar : ''}, adj = 2, pos;
   if (alignToName) {
      bds.align = tbfunction_pgTBObjGet(alignToName, 'bounds').split(',');
   }
   bds.page = tbfunction_pgTBObjGet('page', 'bounds').split(',');
   bds.screen = [window.screenX, window.screenY, window.outerHeight, window.innerHeight];
   bds.titlebar = bds.screen[2] - bds.screen[3];
   pos = [ bds.align[0]*1 + bds.page[0]*1 + bds.screen[0]-adj,
           bds.align[1]*1 + bds.page[1]*1 + bds.screen[1] + bds.titlebar-adj*2,
           bds.align[2], bds.align[3] - Math.round(bds.titlebar/2.65)*2 ];
   
   if (action == 1)
   {
   tbfunction_pgGotoURL("RefWindow", url, pos[0], pos[1], pos[2], pos[3], "", "scrollbars=1", true, true);
   }
   else if (action == 2)
   {setTimeout(window.open('', 'RefWindow').focus(), 1);
//    var c = window.open('', 'RefWindow').closed;
//       if (c == false)
//       {
//       setTimeout(window.open('', 'RefWindow').focus(), 1);
//       }
//       else
//       {
//        tbfunction_pgTimer(false, "save", 500);
//       }
   }
   else if (action == 3)
   {
    window.open('', 'RefWindow').close();
   }
};

action = 1 creates the window
action = 2 refocuses it
action = 3 closes it
The problem is that 2 only works if the window exists. I want to recreate it if it has been closed inadvertently but although I spent hours I can't find a solution. Could you have a look please if you have time?

PS Firefox is also playing up like Chrome now. asking me to login again before I can send this. This time I've copied it so it should be OK.
John
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: popup

Postby John Robin Dove » Wed Mar 20, 2019 7:20 am

Hi Clifton,

I'm just testing the forum. On the subject of popups I find that it is not possible to create more than one popup at a time with Firefox now. This was already the case with Chrome. There seems to be no end to the tightening of security. :(

PS. the forum seems to be behaving better. Thanks. I am using Chrome at the moment.
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: popup

Postby Clifton » Thu Mar 21, 2019 7:37 am

You should be able to create multiple windows using pgGotoURL() by just changing the name of the target parameter.
I just ran a test in Firefox and Chrome and was able to create TWO popup windows each running a different website.
Here is the screenshot:
    Image 3.png
    Click Window 1 to open pgsoftwaretools.com
    Click Window 2 to open betanews.com
    Image 3.png (205.18 KiB) Viewed 1110 times
The key is you must use a different target name for the windows. Theoretically you can have even more windows open in this way.

Not sure if this is similar to what you are trying to achieve, but there is clearly no security restrictions that would prevent this behavior.

P.S.: Made a couple of system changes to forum so hopefully you can access it properly. Please note you should be using https:// (secure access) to view it. I will be making another change shortly to force this redirection for those using unsecured connections.
 
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: popup

Postby John Robin Dove » Sun Mar 24, 2019 7:26 am

Hi Clifton,

Many thanks for your reply. I want to open both windows with one click. Here is my code:
Code: Select all
function tbfunction_popup1(url, open)
{
  if (open == true)
  {
  var w = window.screen.width;
  var h = window.screen.height;
  tbfunction_pgGotoURL("window1", "../../wpt", 0, 0, 553, h, "", "scrollbars=1", true, true);
  w = w - 553
  tbfunction_pgGotoURL("window2", url, 553, 0, w, h, "", "scrollbars=1", true, true);
  }
  else
  {
    window.open('', 'window1').close();
  }
};


but it doesn't seem to be possible. It used to be if I used Firefox but now both browsers require two clicks to open two windows.

On a slightly different aspect of the same subject do you know whether it is possible to create popups like this on a tablet computer? I know it is possible on both pc and mac desktop machines and I know it is impossible on an Android Samsung TAB E. I was wondering about bigger tablets. The Tab E just creates new tabs. I fear this is probably the case with all tablets.

John
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: popup

Postby Clifton » Sun Mar 24, 2019 9:02 am

If you put a delay between the two executions of pgGotoURL(), this code should work. I just tried a sample and set a 3000ms delay and it worked. Probably do not need that big of a delay, but it allowed me to see the effect.
 
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: popup

Postby John Robin Dove » Sun Mar 24, 2019 1:39 pm

Can't get this to work. Firefox blocks the second popup.

Here's my code:

Code: Select all
function tbfunction_popup1(url, open)
{
  if (open == true)
  {
  var h = window.screen.height;
  tbfunction_pgGotoURL("window1", "../../wpt", 0, 0, 553, h, "", "scrollbars=1", true, true);
  var fct = function () {
  var w = window.screen.width;
  w = w - 553;
  var h2 = window.screen.height;
  tbfunction_pgGotoURL("window2", url, 553, 0, w, h2, "", "scrollbars=1", true, true);
  }
  setTimeout( fct, 3000);
  }
  else
  {
    window.open('', 'window1').close();
  }
};
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: popup

Postby Clifton » Sun Mar 24, 2019 4:56 pm

Tried again with only slight modifications to your code and it works in Chrome, Firefox, and Edge.
Her is the XML I used:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<page>
   <config delay="">
      <!--Configuration tags (e.g.: <stylesheet> and <javascript> tags;
          can also include PowerPac function tags; etc.)-->   
   </config>

   <!--Object name tags follow initial configuration tags.-->
   <myBtn>
      <function name="myClick" event="click" params="evt,undef,mX,mY,isShift,isCntl" useTB="true">
         <![CDATA[
            var h = window.screen.height, fct;
            tbfunction_pgGotoURL("window1", "https://betanews.com", 0, 0, 553, h, "", "scrollbars=1", true, true);
            fct = function () {
               var w = window.screen.width - 553, h2 = window.screen.height;
               tbfunction_pgGotoURL("window2", "http://webattack.com", 553, 0, w, h2, "", "scrollbars=1", true, true);
            };
            setTimeout( fct, 3000);
         ]]>
      </function>
   
   </myBtn>
   
   <!--Additional <config#> ... </config#> sections as required.-->
    
</page>

Create a single page with one button and name it "myBtn", load the XML on page load, export the page, click the button and it should work. I did notice that some URL's may give a browser warning to allow popups, but the URL's in the XML above did not trigger and warnings.
 
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: popup

Postby John Robin Dove » Mon Mar 25, 2019 5:54 am

(Just lost all my message because I had to log in again - I must remember to copy my messages EVERY time)
This is what what I wrote, I think.
Thanks for your useful example. It doesn't seem to work here.
Image
Have you perhaps allowed popups on your server? I don't particularly want to go down that route because the program is destined for schools (if it ever gets finished) and I think this might be an unwanted complication. Don't woory about trying to fix it. I have changed my system. The first click opens a new TB HTML in a winow on the left of the screen and it invites the user to click again to open the desired web page in a window on the right side. As both windows cover the entire screen, the risk of a window disappearing under the main program is much reduced.

I'm still a little worried about future browser developments. Will popups be banned completely one day? The othe negative aspect of this system is that while it works well on desktop computers, both pc and mac, it almost certainly does not on tablet computers.

John
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: popup

Postby Clifton » Mon Mar 25, 2019 8:21 am

What are you trying to accomplish with all the windows open? Perhaps there is another way that is more compatible with a wider variety of systems. Generally, same domain windows will open in iframes with no problem, cross domain usually work, but you cannot get data in or out of them back to your parent application; plus, as you are finding out, you are having trouble with multiple windows and their sizing on various devices will be another issue. However, since this is a teaching app, perhaps you can simulate what you are trying to do with a movie clip (screen activity can be streamed to an mp4) and then play that, pausing it momentarily for user to input certain information relative to the lesson taught. Basically an enhanced version of a YouTube video.

Just an idea.

Regarding the login/post issues, what is happening is the forum is switching you from secure (https) to insecure connections, which invariably will log you out. Always make sure the url is showing a secure connection and you posts and login will probably not be lost. I probably need to upgrade this forum to a newer version but have not had the time.
 
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: popup

Postby John Robin Dove » Mon Mar 25, 2019 9:12 am

My program is a web based version of the VB.NET Windows program I made earlier and finished in about 2012. https://www.mediacours.com It allows teachers to exploit 4 types of media file: audio recordings, videos (including videos on YouTube), pictures and web pages. I do not choose these files. They are selected by the teacher and all except YouTube videos and web pages are uploaded to my server. If a teacher chooses a web page that can be shown in an iframe, life is less complicated. If, on the other hand, the teacher chooses to use a web page that cannot be embedded in my program, I need a system to cope with independent windows. I think I have the solution but if students are using tablet devices, it will probably not work. However, all this can be explained to the teacher who will then choose material accordingly.

Re. the login. As far as I know I have not been switching from https to http. The problem is that after a certain time, maybe 5 minutes, the site requires me to log in again and if I have not copied my post, it's not there when I return from logging in. As long as I remember to copy my text, there's no problem I just paste it in again. :)
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron