Click to See Complete Forum and Search --> : HELP!!! - Is it possible...


thenetfreaker
12-05-2003, 12:22 AM
Is it possible to make a webpage that will be stored on my PC that every time i open it, it'll open a specific ULR and then automatically open a link in the already oppened ULR in a popup window ? :confused:

Pittimann
12-05-2003, 01:35 AM
Hi!

If you can predefine the Link to be opened in the popup, that should not be a problem. If you like a random link to be opened I think you will not succeed as far as the popup is concerned.

Here is some code to play with:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
<!--
var wintitle = "popup"; // popup title
var width = "400"; // popup width
var height = "250"; // popup height
LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
windowproperties =
'height='+height+',width='+width+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no';
newwin = window.open('http://www.SomebodysSite.com/SubFolders/SomePage.htm', wintitle, windowproperties);
location.href='http://www.SomebodysSite.com';
//-->
</script>
</head>
<body>
</body>
</html>

Cheers - Pit

thenetfreaker
12-05-2003, 01:47 AM
thanks for the help but that code doesn't work :(

Gollum
12-05-2003, 01:57 AM
It's not entirely clear what it is you want to do...

You want to open some locally stored HTML file which, when opened, redirects to some configured URL- Correct so far?

Then you want to open a popup window with a URL taken from somewhere (one of the above pages?).

Could you fill in the gaps?:confused:

thenetfreaker
12-05-2003, 02:03 AM
ok...
let's say www.google.com is what i want to open in the popup,
and then i want the main page to tell the popup to open a specified link THROUGH that popup [let's say http://www.google.com/ads/]

Pittimann
12-05-2003, 02:11 AM
Hi!

Of course this code doesn't work!!!
'http://www.SomebodysSite.com' doesn't exist.

Replace it with 'http://www.google.com/' and the url I put for the popup with: 'http://www.google.com/ads/'...

Cheers - Pit

Gollum
12-05-2003, 02:12 AM
Ahh, I wondered.
I'm afraid that this is where you will run into one of JavaScript's many security restrictions. It is not possible for a script from one page to access any information from a page in another window (or frame even) that is not from the same domain.

So if you try you will always get an "Access is denied" error.

thenetfreaker
12-05-2003, 02:16 AM
i replaced it and it still does nothing

Gollum
12-05-2003, 02:32 AM
That's not to say that this sort of thing can't be done, just that this is not the way to do it.

If you're on windows, I would suggest using VB with the WebBrowser control (from Microsoft Internet Controls) and MSHTML library and you'll be able to navigate and query the documents to your heart's content.

thenetfreaker
12-05-2003, 02:36 AM
really i dont care what to use javascript, vbscript, i just want it to work.
if it's possible can someone give me the script in VB that will do it ? :D

Pittimann
12-05-2003, 02:50 AM
Hi!

What's the use of opening 'http://www.google.com/' in the popup and then tell the popup to open 'http://www.google.com/ads/'??

Why not having 'http://www.google.com/ads/' from the beginning??

Cheers - Pit

thenetfreaker
12-05-2003, 02:54 AM
that's just an example, but what if u want to make a script that will automatically open a page[i dont even care if it will be opened in a popup] and enter another page[so that this "other pager" will see that i entered it through a specific website and not just by itself]

Pittimann
12-05-2003, 03:07 AM
Hi!

I see: you wanna hack some file(s) or directory(s) to which you don't have access if not coming from a certain page.

Shame on you :p

Cheers - Pit

Gollum
12-05-2003, 03:10 AM
Well, whatever the motives, it can't be done in Javascript (and probably not VBScript either. They're just not allowed.

VB on the other hand has all the permissions it needs (not running in a browser 'n all). Have a play with this

Private Sub Form_Load()
WebBrowser1.Navigate "http://www.google.com"
End Sub


Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim doc As HTMLDocument
Dim links As IHTMLElementCollection
Dim a As HTMLLinkElement

Set doc = WebBrowser1.Document
Set links = doc.getElementsByTagName("a")

For Each a In links
If a <> "" Then
Me.Caption = a
WebBrowser1.Navigate a
Exit Sub
End If
Next a
End Sub

thenetfreaker
12-05-2003, 07:30 AM
and what does it do [the code] ?:rolleyes: