Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript window.location DIV?

 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys

Just wondering can you have a Javascript function that uses something like the window.location to open a html page in a div?

The reason we need this is we have a current system that uses a url to redirect to a page that used to appear in a popup (using window.open) but now the powers that be want page to appear within the current page, so I was thinking of a div (simulated popup) who would be made visible (easy to do) that displayed the html. I tried the window.location command but that redirect to a new page (just displaying the html)

So as I say, is there a way of doing something like "window.location = url" targets <div id="myId">

Cheers

KS
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64696
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can;t just shove an entire page of markup into a <div> and expect it to work. You'll either need to refactor the "included page" to be an HTML fragment that's legal to place within a <div> and use Ajax to fetch the fragment, or use an iframe to house the page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic