• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

javascript and include files?

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using jsp?
 
Michael Huber
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no javascript
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
read this:
http://www.smartwebby.com/web_site_design/server_side_includes.asp
 
Michael Huber
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok thanks, got it
 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic