473,569 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing new URL in onbeforeunload - or similar effect by othermeans

Hi,

I'm working on a substantial AJAX-type application. The latest feature
I've added is the ability to append a query string to the end of the
normal URL, which will cause the application to open a new tab (within
itself, not a browser tab) according to the contents of this string,
alongside the normal tabs it provides. This all works as expected.

What I would now like to do is provide the ability to open a second such
tab alongside the first, without leaving the application (it has an
unfortunately long startup time due to a slow server I have no control
over). My initial plan was to trap onbeforeunload (which I already do to
provide a "do you want to quit?" dialog), see what the new URL is, and
if it's the URL of the application but with a different query string,
cancel the unload and create the new tab instead.

Of course, this doesn't work, and there are a couple of perfectly good
reasons why it never could have done. But does anyone have a suggestion
for a different approach?

Thanks,

Pete
Jan 26 '07 #1
2 3477
Pete Verdon <ne**@verdonet. organisation.un itedkingdom.inv alidwrote:
What I would now like to do is provide the ability to open a second such
tab alongside the first, without leaving the application (it has an
unfortunately long startup time due to a slow server I have no control
over). My initial plan was to trap onbeforeunload (which I already do to
provide a "do you want to quit?" dialog), see what the new URL is, and
if it's the URL of the application but with a different query string,
cancel the unload and create the new tab instead.

Of course, this doesn't work, and there are a couple of perfectly good
reasons why it never could have done. But does anyone have a suggestion
for a different approach?
If there was a way to catch the unload and prevent it happening then popup
adverts everywhere would use it to prevent you closing the popups.

A different approach would be to use the onload event for your page to go
through all <atags in the page and add an onclick handler which does what
you want.
Jan 26 '07 #2
Duncan Booth wrote:
Pete Verdon <ne**@verdonet. organisation.un itedkingdom.inv alidwrote:
>My initial plan was to trap onbeforeunload (which I already do to
provide a "do you want to quit?" dialog), see what the new URL is, and
if it's the URL of the application but with a different query string,
cancel the unload and create the new tab instead.

Of course, this doesn't work, and there are a couple of perfectly good
reasons why it never could have done. But does anyone have a suggestion
for a different approach?
If there was a way to catch the unload and prevent it happening then popup
adverts everywhere would use it to prevent you closing the popups.
Yup, that's one of the reasons I thought of :-)
A different approach would be to use the onload event for your page to go
through all <atags in the page and add an onclick handler which does what
you want.
I don't think that would do what I need. I want people to be able to
paste in URLs (or load bookmarks, or whatever) in the same window, to
kick the client into a new state. People here really want to be able to
IM / email each other links to particular entities/states within the
application. What I've done so far will allow them to load one such URL,
but if they have a second they would have to load another copy of the
app, which is a) slow and b) bypasses the existing interface which
allows them to look at several things side-by-side.

Of course, this is even more of a perversion of the standard browser
model than normal AJAX is :-)

Perhaps I can work around it by adding a text field to paste additional
URLs into, but it's not ideal.

Pete
Jan 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1049
by: benzwt | last post by:
I have visited a site http://www.shareconnector.com/modules.php?name=Edonkey&d_op=viewdownload&cid=11 when my mouse points on the links like "TotallyMAD CD-ROM CD 4" there is a small window appears. How do make this effect ? please give me some hints.
0
1854
by: Rick Lubanovic | last post by:
I have been working on a script to check if a page has changed before the user leaves the page. I have a call to a javascript function on the onbeforeunload event. This seems to work in most cases. However, in my testing, the onbeforeunload event is sent twice. This causes problems in certain cases where I want to suppress the "The page...
4
11861
by: lilfos | last post by:
Hi there, I have an asp.net page with essentially a "don't forget to save" pop-up that is called when the user attempts to navigate away from the page. The user has the option to cancel and prevent the page from unloading. Since the form data is posted back to the server and saved during a normal postback, I don't need to prompt unless...
3
6221
by: Tony | last post by:
OK - I know the mantra, so let's be clear: I'm working on a web application that we want to be able to simply warn the user that they might lose data (or the current application state - it's .NET) if they navigate away from the page using the Back button. I was thinking of using onbeforeunload (which seems to work with IE, FF, and Netscape,...
0
1506
by: acknowledged74 | last post by:
Hi I've been looking around for sometime but can't seem to find any tutorials on page loading. i.e. when the elements ( buttons, pictures etc) wiz onto the screen from different places with noises etc, not a timeline preloader/loader. Also I would like to achieve a similar effect to http://www.chalkmedia.co.uk/chalkmedia.htm how the pictures...
1
108697
Frinavale
by: Frinavale | last post by:
Introduction I've seen many questions asked about how to disable the browser's back button and in the past I've replied with "it's simply not possible". It's not a good idea to disable the back button anyways, if the user ventures away from your page then they wouldn't have this button at their disposal. The main reason people ask how to...
1
1962
by: Ronny | last post by:
Anyone who plays around with Windows Media Player can experience the skin effect that enables the standard menu items to appear/disappear. Is there any way to achieve a similar effect with c# form application? Regards Ronny
1
3529
by: Devin | last post by:
Hi, I'll explain what I am trying to do and hopefully you can suggest how I can do it, or another way I could create a similar effect. My company uses vCalendar which I know my way around in pretty well. When the administrator of the calendar makes a new event (this person isn't computer savvy) they need to enter in the field for...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.