This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes javascript and include files? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript and include files?" Watch "javascript and include files?" New topic
Author

javascript and include files?

Michael Huber
Ranch Hand

Joined: Aug 20, 2004
Posts: 43
I have a question, is there a way to write a script which overrides all
links basically opening all the links in new windows. I can't change the html file cause I get it from somewhere and I use it as an include file on my website.

The problem is that I popup that html include file on my site and it has links and when someone click on a link it opens in that small window, and you can't resize it. I basically want to override all links and make them open in a new window

any ideas?

thanks for all the help
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
you can look at the document link array

play with this:



Have no clue what would cause the pop up windows without looking at it.

Eric
Michael Huber
Ranch Hand

Joined: Aug 20, 2004
Posts: 43
I don't think I can access the code in the include file

but I could access that include files links right? basically overriding it right
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
If you include the page in yours, it becomes your html which you can manipulate. If you link to it via an iframe or frame, you would not be able to manipulate it.

You would have to call a function on page load that would traverse all the links. Are they callin a function to open a window or are they using a target attribute?

Eric
Michael Huber
Ranch Hand

Joined: Aug 20, 2004
Posts: 43
No the include file is not mine, someone is providing
it to me and they want it on my site

also how can I include this html page onto my page
I don't know the call is it something like this <#include file = "example.html">
So the contents of example.html come out on my page. Then I want to be able to
make all links in example.html come up in new windows cause example.html is fixed
to a certain size for its contents but the links inside example are links to other
full sized pages

thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Are you using jsp?
Michael Huber
Ranch Hand

Joined: Aug 20, 2004
Posts: 43
no javascript
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
read this:
http://www.smartwebby.com/web_site_design/server_side_includes.asp
Michael Huber
Ranch Hand

Joined: Aug 20, 2004
Posts: 43
ok thanks, got it
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
If you include the page in yours, it becomes your html which you can manipulate. If you link to it via an iframe or frame, you would not be able to manipulate it.

Why not? You can access objects of other frames after all.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Why Not?

Cross Domain Scripting is the reason why. It is there to prevent people from hijacking another page without their knowledge. IE brings up an alert asking you if it should continue or you get an access denied error depending on the operation your JavaScript has taken.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javascript and include files?
 
Similar Threads
create new session in jsp
Prevent multiple login to web app
Eclipse/MyEclipse Existing War file
how to include html file?
Finding links in an HTML file