Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

New File  (Ctrl+N) Problem  in IE

Posted on 2004-04-30
12
Medium Priority
?
466 Views
Last Modified: 2012-08-13
Here's the situation, it's a bit a tricky...

A classic ASP application

User opens the IE browser to run the web app and then creates an instance of the web app in another IE window, sharing the same session and cookies.  This causes some problems.

This there any way to do any of the following...
1) prevent user from selecting New File command in IE
2) trap the fact that this has occurred and start a new session or redirect the user to a login page

Note: this is an Internet app, so opening the app in a menuless window is not an option.  Would prefer an ASP only or javascript solution.

Thanks!
0
Comment
Question by:dfiala13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 21

Expert Comment

by:ap_sajith
ID: 10961849
Dont think its quite possible...

Also, Open in a new window does not create a new session. and there is no way to trap it.

Why are are even contemplating doing this?

Cheers!!
0
 
LVL 12

Author Comment

by:dfiala13
ID: 10962124
I would like to see if someone knows of a way to figure out when this action has happened.  It is not something I want to do, but need to deal with because of the behavior of IE.  
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10963738
Think of this way--the new open window is a client side event, so there is no real way of server-side code catching that.

Fritz the Blank
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Author Comment

by:dfiala13
ID: 10963976
I am aware of that.  Is there a client side way of catching it? Is there a way of preventing it?
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10963987
Are you saying is there a way to catch the crtl + N key combination?

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10964001
Even if you did, that wouldn't stop someone from opeing a new window from the file menu.

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10964059
But here is some code for you to look at (not mine):

<html>
<head>
<script type="text/javascript">
<!--
window.onload = function() { document.onkeydown = register;      document.onkeyup = register; var x = document.forms[0].elements[0];      x.onkeydown = register;      x.onkeyup = register;}
function register(e)
{
      if (!e) e = window.event;
      var keyInfo = String.fromCharCode(e.keyCode) + '\n';
      keyInfo += 'Event: ' + e.type + '\n\n';
      keyInfo += 'You pressed: ' + String.fromCharCode(e['keyCode']) + ' [Decimal: ' + e['keyCode'] + ']\n';
      keyInfo += 'ALT: ' + e['altKey'] + '\n';
      keyInfo += 'CTRL: ' + e['ctrlKey'] + '\n';
      keyInfo += 'SHIFT: ' + e['shiftKey'] + '\n';
      keyInfo += 'REPEAT: ' + e['repeat'] + '\n';
      keyInfo += 'WHICH: ' + e['which'];
      document.forms[1].log.value = keyInfo;
}

// -->
</script>
</head>
<body>
    <form action="return false;" >
       <p> <b>Enter something here: </b><br />
        <br />
        <textarea cols="24" rows="6" style="width:220px;border: 1px #ccc
solid"></textarea>
      </p>
      </form>
    </div>

    <div style="margin-left: 24px; float:left; margin-top: 51px">
     <form action="return false;">
      <p>
      <b>And the key events will be displayed here: </b><br />
        <br />
        <textarea style="background: #eee; border: 1px #ccc solid; padding: 15px; overflow: hidden; width: 330px; font-family: Arial, sans-serif; font-size: 11px" name="log" rows="12" cols="42"></textarea>
        <br />
        <br />
        <input type="button" value="Clear key info"      onclick="document.forms[1].elements['log'].value = ''" />
       </p>
      </form>
     </div>

</body>
</html>


FtB
0
 
LVL 12

Author Comment

by:dfiala13
ID: 10964103
I will restate:

is there a way to detect the File New event in IE, no matter how it is generated?

Barring that , when the newly created is requested from the server, is there some clever way to detect that this page was created using File New?


0
 
LVL 46

Assisted Solution

by:fritz_the_blank
fritz_the_blank earned 800 total points
ID: 10964135
To review:

>>Is there a way to detect the File New event in IE, no matter how it is generated? <<

No, since the web is essentially stateless, there is no way for server-side code to detect what happens client side. With the JavaScript that I gave you, it is possible to make a client-side detction of the ctrl-N keyboard event, but there is nothing that can be done to detect the File-->New-->Window


>>Barring that , when the newly created is requested from the server, is there some clever way to detect that this page was created using File New?<<

No.

Fritz the Blank
0
 
LVL 21

Accepted Solution

by:
ap_sajith earned 1200 total points
ID: 10964156
I dont see any means..

Unless you store some value in a cookie or database which says that the current page opened at (time).

For example, when i execute the current page, i add a cookie value called page with the page name as the key and the current time as the value.

When i open the page, i would be checking if the cookie value exists, if it exists, i have opened a new window. If it doesnt, i am opening the page for the first time.

The cookie value should be cleared when the user logs out and preferably when the user moves on to a different page. This can be easily achieved by iterating through the cookies collection.

Just an idea.. you'll have to work on it.

Hope this helps..

Cheers!!
0
 
LVL 12

Author Comment

by:dfiala13
ID: 10978201
Thanks for all the responses. The cookie idea looks the only possibility.  Shame to have to include the code on every page, but doesn't offer any control higher up the pipeline as ASP.NET does.
0
 

Expert Comment

by:Evolutionmarketplace
ID: 11946479
Dear ap_sajith,

Your solution with the cookies is fantastic, and I am trying to apply it but with a session variable.

My question is, what happens when the user refreshes the screen (F5)?, is there any way to detect or prevent the user from using the F5 key?

Thanks,

Pablo
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question