473,327 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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 3466
Pete Verdon <ne**@verdonet.organisation.unitedkingdom.invalidw rote:
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.unitedkingdom.invalidw rote:
>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
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...
0
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...
4
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...
3
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)...
0
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...
1
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...
1
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...
1
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.