Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
How do I restrict a linked web browser size?
Old 01-17-2007, 11:28 PM How do I restrict a linked web browser size?
Novice Talker

Posts: 9
Name: Caleb
Trades: 0
Hi all...

...Basically I want to have some links (images) open into a new browser window that opens only to the size of the image.

Linking them into a new window has been easy... but I'd really prefer them not to open in a maximised version of the browser... I'm using Dreamweaver3, but am happy to edit the html myself.

I had this posted in the web design section but this looks like a more suited forum…

Any advice would be greatly appreciated.
Nat B is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-18-2007, 01:57 AM Re: How do I restrict a linked web browser size?
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I think you'll need to use a little JavaScript to open the window to a specific size.

It's not very difficult to do even if you're not familiar with JavaScript. You use the open method of the window object, which sounds more confusing than it is.

It looks something like:

window.open('pathToYourImage', 'nameForNewWindow', 'somePropertiesYouCanControl');

you can use anything you want for the name of the window. It's mostly if you want to be able to do things with it later. The two properties you'll be most concerned with are the width and heght.

Your link might look something like

<a href="#" onclick="window.open('image.jpg', 'myWindow', 'width=400, height=300');" >Link Text</a>

The # just lets the html know that some JavaSript code is coming.

Here's a little more info from w3schools. Try the links at the bottom for the 'try it yourself demos.' You can try out different code and see what happens.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 01-18-2007, 02:36 AM Re: How do I restrict a linked web browser size?
Novice Talker

Posts: 9
Name: Caleb
Trades: 0
Thanks, this was exactly what I was after... but I found it after I went and fount an extension to do it.... ****!

so I'm sorted...

Thanks though!
Nat B is offline
Reply With Quote
View Public Profile
 
Old 01-18-2007, 11:50 AM Re: How do I restrict a linked web browser size?
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
Don't use # as an href... just link to your file as normal and use the code below so that non-js browsers can access the content:

<a href="image.jpg" onclick="window.open(this.href, 'myWindow', 'width=400, height=300');return false;" >Link Text</a>

and # actually just points to a blank anchor name, so in essence, the page just links back to itself. (it has nothing to do with JS) The return false will stop the browser from following the link, and loading the image in the current window.

Last edited by funkdaddu; 01-18-2007 at 11:53 AM..
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 01-18-2007, 03:17 PM Re: How do I restrict a linked web browser size?
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Thanks funkdaddu. I always associate the # with JS, because that's generally where I see it, but I know you're right.

I think your practice of actually using a real path in the href is a better idea too for exactly the reason you mention. Thanks for the correction. My bad.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to How do I restrict a linked web browser size?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17746 seconds with 12 queries