473,418 Members | 2,020 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,418 software developers and data experts.

Internet Explorer Browser Extension: Switching from Live to Development and back again with a browser extension or BHO--how to create it?

Hello:

I would like to develop a browser extension, or whatever such a thing
is classified as, that would allow a user of IE6, and possibly IE7,
to
switch between a live and development page.

I'm sure the individuals reading this are familiar with what I'm
referring to; however, I'll provide an example.

I'm currently viewing a page, which is http://www.project.com/project-five.jsp,
and I would like to view the development version of that page, which
is http://project.dev.project.com/project -five.jsp--I would like to
switch back and forth
with one button, which of course would be "attached" to whatever
scripting language
accommodates such an action. I've had limited success with the "href"
and window.location
(or location.window) function in JS, but nothing that would allow me
to do the aforementioned.

I'm thinking that the code for this process would be executed by a
button
on the browser toolbar, which would be fed from the registry, which
is
probably the only part of this procedure I know how to perform.

I'm aware of Server Switcher, a browser add-on for FireFox, but I
would need to have this component for IE 6 and IE 7, and I would need
to develop this myself

I 'd like to know what tools I need for this type of project, and
what
type of programming I'm looking at; type of environment am I looking
at working in?

I've looked at some javascript and I've been given some code, but none
that I can seem to make work.

If this is a simple coding procedure that someone is familiar with
and
it could be provided here, it would be greatly appreciated.

If you believe that this message would be better suited posted to
another discussion group, please advise.
Thank you in advance for your time and attention.
---------------------------------------------------------------------------*-----
Daniel R. Young

Jun 12 '07 #1
7 2695
Danny said the following on 6/12/2007 11:12 AM:
Hello:

I would like to develop a browser extension, or whatever such a thing
is classified as, that would allow a user of IE6, and possibly IE7,
to switch between a live and development page.
I do that daily with IE7 and it is trivial. I open the development page
in on tab, the live page in another and switch between tabs. Why do I
need an add-on to allow me to do that? With IE6, there are already
add-ons that allow you to have tabbed browsing. Prior to the tabs, I
would simply open two browser windows and open two pages. No need for a
plugin/extension.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 12 '07 #2
On Jun 12, 12:23 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Danny said the following on 6/12/2007 11:12 AM:
Hello:
I would like to develop a browser extension, or whatever such a thing
is classified as, that would allow a user of IE6, and possibly IE7,
to switch between a live and development page.

I do that daily with IE7 and it is trivial. I open the development page
in on tab, the live page in another and switch between tabs. Why do I
need an add-on to allow me to do that? With IE6, there are already
add-ons that allow you to have tabbed browsing. Prior to the tabs, I
would simply open two browser windows and open two pages. No need for a
plugin/extension.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
If it were that simple, I wouldn't have posted such a question. An add-
on such as this is available in FireFox, which supports tabbed
browsing. This add-on would concatenate the dev. URL, keep the path
and file name, but replace the domain. Get it? If you don't
collaborate with end-users, I doubt you'd understand why there's a
need for such an add-on,

Thanks anyway.

Jun 12 '07 #3
Danny said the following on 6/12/2007 5:43 PM:
On Jun 12, 12:23 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
>Danny said the following on 6/12/2007 11:12 AM:
>>Hello:
I would like to develop a browser extension, or whatever such a thing
is classified as, that would allow a user of IE6, and possibly IE7,
to switch between a live and development page.
I do that daily with IE7 and it is trivial. I open the development page
in on tab, the live page in another and switch between tabs. Why do I
need an add-on to allow me to do that? With IE6, there are already
add-ons that allow you to have tabbed browsing. Prior to the tabs, I
would simply open two browser windows and open two pages. No need for a
plugin/extension.
If it were that simple,
It *is* that simple and I even told you how.
I wouldn't have posted such a question.
Just because you ask a question doesn't mean the solution isn't simple.
An add-on such as this is available in FireFox,
Then someone wasted a lot of time on making something for Firefox that
is trivial to do without a plug-in/add on.
which supports tabbed browsing. This add-on would concatenate the dev. URL,
keep the path and file name, but replace the domain.
I can do that with a bookmark, add it to the toolbar. Why do I need an
addon?
Get it?
I got it the first time I answered you. You are the one trying to make
it more difficult than it is.
If you don't collaborate with end-users, I doubt you'd understand
why there's a need for such an add-on,
I "collaborate" with my end-users on a daily basis. Most times I
"collaborate" with them more than I wanted to.

x=document.location;
k = x.href.substring(8);
//change the 8 to pick up the parts you want to keep.
y = x.href.substring(0,8);
//change the 8 to pick up the live domain that you want to discard.
if(y="liveURLHere")
{x.href="devURLHere" + filePath}
else
{x.href="liveURLHere" + filePath}

Substitute the devURL and the liveURL, remove the comments, put it all
on one line, save it as a bookmarklet, add it to the IE toolbar.

Now, since you "Get it" and you seem to think I don't. Can you please
explain to me, and anybody else reading, why I need to install an addon
(to any browser) to allow me to do what the above bookmarklet will do?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 13 '07 #4
On Jun 13, 12:54 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Danny said the following on 6/12/2007 5:43 PM:
On Jun 12, 12:23 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Danny said the following on 6/12/2007 11:12 AM:
>Hello:
I would like to develop a browser extension, or whatever such a thing
is classified as, that would allow a user of IE6, and possibly IE7,
to switch between a live and development page.
I do that daily with IE7 and it is trivial. I open the development page
in on tab, the live page in another and switch between tabs. Why do I
need an add-on to allow me to do that? With IE6, there are already
add-ons that allow you to have tabbed browsing. Prior to the tabs, I
would simply open two browser windows and open two pages. No need for a
plugin/extension.
If it were that simple,

It *is* that simple and I even told you how.
I wouldn't have posted such a question.

Just because you ask a question doesn't mean the solution isn't simple.
An add-on such as this is available in FireFox,

Then someone wasted a lot of time on making something for Firefox that
is trivial to do without a plug-in/add on.
which supports tabbed browsing. This add-on would concatenate the dev. URL,
keep the path and file name, but replace the domain.

I can do that with a bookmark, add it to the toolbar. Why do I need an
addon?
Get it?

I got it the first time I answered you. You are the one trying to make
it more difficult than it is.
If you don't collaborate with end-users, I doubt you'd understand
why there's a need for such an add-on,

I "collaborate" with my end-users on a daily basis. Most times I
"collaborate" with them more than I wanted to.

x=document.location;
k = x.href.substring(8);
//change the 8 to pick up the parts you want to keep.
y = x.href.substring(0,8);
//change the 8 to pick up the live domain that you want to discard.
if(y="liveURLHere")
{x.href="devURLHere" + filePath}
else
{x.href="liveURLHere" + filePath}

Substitute the devURL and the liveURL, remove the comments, put it all
on one line, save it as a bookmarklet, add it to the IE toolbar.

Now, since you "Get it" and you seem to think I don't. Can you please
explain to me, and anybody else reading, why I need to install an addon
(to any browser) to allow me to do what the above bookmarklet will do?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

OK, I've used the wrong terminology and that's why you're viewing this
as superfluous-I at least that's why I've interpreted this as. Instead
of add-on, I should have said IE Toolbar button, but not a favorite.

I did as you suggested, with the code pasted above, and the script
host returned an error: "'window is undefined'."

It's possible that I didn't describe this requirement of the script. I
would need the script to understand that the path and filename will
not be the same in all instances. Sometimes you'd visit
http://www.live.com/file-path-name.jsp and want to switch to it's
respective development page, but other instances the file and path
name would be http://www.live.com/ff2-pp2-nn2.jsp, and I would need
the script to recognize the path and file name, capture it, (or
whatever function JS could provide in such a situation), and replace
the live domain (http://www.live.com) with the development domain
(http://live.dev.live.com).

Jun 13 '07 #5
Danny said the following on 6/13/2007 2:04 PM:
On Jun 13, 12:54 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
>Danny said the following on 6/12/2007 5:43 PM:
>>On Jun 12, 12:23 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Danny said the following on 6/12/2007 11:12 AM:
Hello:
I would like to develop a browser extension, or whatever such a thing
is classified as, that would allow a user of IE6, and possibly IE7,
to switch between a live and development page.
I do that daily with IE7 and it is trivial. I open the development page
in on tab, the live page in another and switch between tabs. Why do I
need an add-on to allow me to do that? With IE6, there are already
add-ons that allow you to have tabbed browsing. Prior to the tabs, I
would simply open two browser windows and open two pages. No need for a
plugin/extension.
If it were that simple,
It *is* that simple and I even told you how.
>>I wouldn't have posted such a question.
Just because you ask a question doesn't mean the solution isn't simple.
>>An add-on such as this is available in FireFox,
Then someone wasted a lot of time on making something for Firefox that
is trivial to do without a plug-in/add on.
>>which supports tabbed browsing. This add-on would concatenate the dev. URL,
keep the path and file name, but replace the domain.
I can do that with a bookmark, add it to the toolbar. Why do I need an
addon?
>>Get it?
I got it the first time I answered you. You are the one trying to make
it more difficult than it is.
>>If you don't collaborate with end-users, I doubt you'd understand
why there's a need for such an add-on,
I "collaborate" with my end-users on a daily basis. Most times I
"collaborate" with them more than I wanted to.

x=document.location;
k = x.href.substring(8);
//change the 8 to pick up the parts you want to keep.
y = x.href.substring(0,8);
//change the 8 to pick up the live domain that you want to discard.
if(y="liveURLHere")
{x.href="devURLHere" + filePath}
else
{x.href="liveURLHere" + filePath}

Substitute the devURL and the liveURL, remove the comments, put it all
on one line, save it as a bookmarklet, add it to the IE toolbar.

Now, since you "Get it" and you seem to think I don't. Can you please
explain to me, and anybody else reading, why I need to install an addon
(to any browser) to allow me to do what the above bookmarklet will do?
OK, I've used the wrong terminology and that's why you're viewing this
as superfluous-I at least that's why I've interpreted this as. Instead
of add-on, I should have said IE Toolbar button, but not a favorite.
Why though? Why won't a favorite work if it can be coded to work?
I did as you suggested, with the code pasted above, and the script
host returned an error: "'window is undefined'."
That is an odd error as nothing in the script tried to access a "window".
It's possible that I didn't describe this requirement of the script. I
would need the script to understand that the path and filename will
not be the same in all instances.
I understood that part :-)
Sometimes you'd visit http://www.live.com/file-path-name.jsp and
want to switch to it's respective development page, but other
instances the file and path name would be http://www.live.com/ff2-pp2-nn2.jsp,
and I would need the script to recognize the path and file name,
capture it, (or whatever function JS could provide in such a
situation), and replace the live domain (http://www.live.com)
with the development domain (http://live.dev.live.com).
If all you want to change is the domain of the page, no sub folders,
then you simply read the document.domain property which gives you the
www.live.com (or live.dev.live.com part) of the URL. You check that to
see which it is - live or dev - and replace it with the other, then set
location.href of the current page. The snippet I posted before had a
flaw where it assumed (incorrectly) that the domain names would be the
same length when that isn't always true.

//set a variable to the location.href property
k=location.href;
//read the domain
m=document.domain;
//define a variable for each domain name
n="www.live.com";
p="live.dev.live.com";
//check the domain to see which it is and branch accordingly
if(document.domain == n){
//replace the domain name in k with the new domain name
k=k.replace(m,p);
}else{
//replace the domain name in k with the domain name of p
k=k.replace(m,n)
}
//k now equals a string that represents the new URL so
//set the location.href property to k
location.href = k;

When you strip out the comments, remove the linebreaks, and add the
javascript: protocol to it, you end up with this:

javascript:k=location.href;m=document.domain;n="ww w.live.com";p="live.dev.live.com";if(document.doma in==n){k=k.replace(m,p);}else{k=k.replace(m,n)}loc ation.href=k;

Save it as a bookmark.
Edit the n and p variables to match your respective domain names.

I don't have two live servers that I can tinker with right now to
thoroughly test it with but testing with variables instead of
location.href and document.domain I can't get it to fail in IE7. Try it
and if it still throws an error then let me know what the error was and
I will look into it some more. Whether you use a bookmark written in
javascript or any other language the process is the same.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 13 '07 #6
On Jun 13, 5:52 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Danny said the following on 6/13/2007 2:04 PM:


On Jun 13, 12:54 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Danny said the following on 6/12/2007 5:43 PM:
>On Jun 12, 12:23 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Danny said the following on 6/12/2007 11:12 AM:
Hello:
I would like to develop a browser extension, or whatever such a thing
is classified as, that would allow a user of IE6, and possibly IE7,
to switch between a live and development page.
I do that daily with IE7 and it is trivial. I open the development page
in on tab, the live page in another and switch between tabs. Why do I
need an add-on to allow me to do that? With IE6, there are already
add-ons that allow you to have tabbed browsing. Prior to the tabs, I
would simply open two browser windows and open two pages. No need for a
plugin/extension.
If it were that simple,
It *is* that simple and I even told you how.
>I wouldn't have posted such a question.
Just because you ask a question doesn't mean the solution isn't simple.
>An add-on such as this is available in FireFox,
Then someone wasted a lot of time on making something for Firefox that
is trivial to do without a plug-in/add on.
>which supports tabbed browsing. This add-on would concatenate the dev.. URL,
keep the path and file name, but replace the domain.
I can do that with a bookmark, add it to the toolbar. Why do I need an
addon?
>Get it?
I got it the first time I answered you. You are the one trying to make
it more difficult than it is.
>If you don't collaborate with end-users, I doubt you'd understand
why there's a need for such an add-on,
I "collaborate" with my end-users on a daily basis. Most times I
"collaborate" with them more than I wanted to.
x=document.location;
k = x.href.substring(8);
//change the 8 to pick up the parts you want to keep.
y = x.href.substring(0,8);
//change the 8 to pick up the live domain that you want to discard.
if(y="liveURLHere")
{x.href="devURLHere" + filePath}
else
{x.href="liveURLHere" + filePath}
Substitute the devURL and the liveURL, remove the comments, put it all
on one line, save it as a bookmarklet, add it to the IE toolbar.
Now, since you "Get it" and you seem to think I don't. Can you please
explain to me, and anybody else reading, why I need to install an addon
(to any browser) to allow me to do what the above bookmarklet will do?
OK, I've used the wrong terminology and that's why you're viewing this
as superfluous-I at least that's why I've interpreted this as. Instead
of add-on, I should have said IE Toolbar button, but not a favorite.

Why though? Why won't a favorite work if it can be coded to work?
I did as you suggested, with the code pasted above, and the script
host returned an error: "'window is undefined'."

That is an odd error as nothing in the script tried to access a "window".
It's possible that I didn't describe this requirement of the script. I
would need the script to understand that the path and filename will
not be the same in all instances.

I understood that part :-)
Sometimes you'd visithttp://www.live.com/file-path-name.jspand
want to switch to it's respective development page, but other
instances the file and path name would behttp://www.live.com/ff2-pp2-nn2.jsp,
and I would need the script to recognize the path and file name,
capture it, (or whatever function JS could provide in such a
situation), and replace the live domain (http://www.live.com)
with the development domain (http://live.dev.live.com).

If all you want to change is the domain of the page, no sub folders,
then you simply read the document.domain property which gives you thewww.live.com(or live.dev.live.com part) of the URL. You check that to
see which it is - live or dev - and replace it with the other, then set
location.href of the current page. The snippet I posted before had a
flaw where it assumed (incorrectly) that the domain names would be the
same length when that isn't always true.

//set a variable to the location.href property
k=location.href;
//read the domain
m=document.domain;
//define a variable for each domain name
n="www.live.com";
p="live.dev.live.com";
//check the domain to see which it is and branch accordingly
if(document.domain == n){
//replace the domain name in k with the new domain name
k=k.replace(m,p);}else{

//replace the domain name in k with the domain name of p
k=k.replace(m,n)}

//k now equals a string that represents the new URL so
//set the location.href property to k
location.href = k;

When you strip out the comments, remove the linebreaks, and add the
javascript: protocol to it, you end up with this:

javascript:k=location.href;m=document.domain;n="ww w.live.com";p="live.dev.live.com";if(document.doma in==n){k=k.replace(m,p);}else{k=k.r*eplace(m,n)}lo cation.href=k;

Save it as a bookmark.
Edit the n and p variables to match your respective domain names.

I don't have two live servers that I can tinker with right now to
thoroughly test it with but testing with variables instead of
location.href and document.domain I can't get it to fail in IE7. Try it
and if it still throws an error then let me know what the error was and
I will look into it some more. Whether you use a bookmark written in
javascript or any other language the process is the same.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/- Hide quoted text -

- Show quoted text -
The message I'm receiving is 'location is undefined.' I've saved the
file as a .js file, and placed it in Internet Explorer's Favorites
folder. Should this be an html file?

Thanks.

Jun 14 '07 #7
Danny said the following on 6/14/2007 10:25 AM:
On Jun 13, 5:52 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
>Danny said the following on 6/13/2007 2:04 PM:
>>On Jun 13, 12:54 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
<snip>
>When you strip out the comments, remove the linebreaks, and add the
javascript: protocol to it, you end up with this:

javascript:k=location.href;m=document.domain;n="w ww.live.com";p="live.dev.live.com";if(document.dom ain==n){k=k.replace(m,p);}else{k=k.r*eplace(m,n)}l ocation.href=k;
<snip>
The message I'm receiving is 'location is undefined.' I've saved the
file as a .js file, and placed it in Internet Explorer's Favorites
folder. Should this be an html file?
No, the above code, that begins with javascript: is the URL of a favorites.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 16 '07 #8

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

Similar topics

2
by: Justin | last post by:
Need help.. I am creating cookies in php, which works fine in Mozilla in the same session, for example I can create them and then go to another page and then come back to the page and see the...
1
by: Ashvin Navare | last post by:
Hi, We want to disable BACK & FORWARD button of the browser so that user is forced to navigate through the menu options provided in the site. The browser used is Internet Explorer only. Please...
5
by: Edward Mitchell | last post by:
Is there a way that I can repair MS Internet Explorer? I seem to have broken it somewhere. I have been developing a .NET app. Three days ago I saw a message box in a web site that I visit saying...
2
by: Tim Stevens | last post by:
Hello, This is the first time I have had to resort to posting on here, as Ive always been able to find a solution to my problems in the past by browsing postings by others. So, to start with I...
6
by: Sandy | last post by:
Hello - I have a little application that I would like to have an exit button on that closes my web application and closes Internet Explorer. What is the code that will do that? Any help...
21
by: Joe Attardi | last post by:
Hey all! I was reading over at the IE Blog the other day http://http://blogs.msdn.com/ie/] and read some interesting, and encouraging news. According to Sunava Dutta, an IE Program Manager,...
9
by: Etayki | last post by:
Hi! I am new to VB.net and I am using the Visual Basic 2005 Express Edition I have two questions: 1. I am trying to write an application that will automate Internet Explorer and store data...
11
by: ft310 | last post by:
Use Internet Explorer go to http://rhodeisland-aa.org/tester/meetings/index.htm On the left click "and go to meetings" Click any address in the right hand 'location' column. The entire page...
6
by: kitkatrobins | last post by:
Hi, I am creating an Internet Explorer add on. I am doing this using Browser Help Objects in C++. I've been programming for many years but mainly as a c# developer and have had little experience...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...

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.